Skip to main content
We are currently experiencing a higher than average ticket volume and as such our responses may be delayed. Searching on our Help Center articles or going to our Community is also a great resource for answers.

node.js app HTML file not loading external resources

Comments

3 comments

  • cPRex Jurassic Moderator

    Hey there!  Our support for Node.js is limited to ensuring a default application works as outlined at https://docs.cpanel.net/knowledge-base/web-services/how-to-install-a-node.js-application/.  If there are issues with that process you'll need to submit a ticket so we can take a look at the system.

    0
  • Kevin Price-Ward

    cPRex - hi there, just a follow up on this, I have managed to get a node.js app up and running on cPanel and loading socket.io by using the following in my /public_html/.htaccess file:

    # DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
    PassengerAppRoot "/home/cache4x4tyresco/apps/testapp"
    PassengerBaseURI "/"
    PassengerNodejs "/home/cache4x4tyresco/nodevenv/apps/testapp/12/bin/node"
    PassengerAppType node
    PassengerStartupFile app.js
    # DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
    # DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
    <IfModule Litespeed>
    </IfModule>
    # DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END

    BUT - this conflicts with my WordPress rewrite rules which are:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    Basically with the WordPress rules in my .htaccess my node.js app's index.html file does not load socket.io (it gives a 404 error), however if I comment the WordPress rules out, it works fine, but then WordPress doesn't work (apart from the homepage). Doesn't seem to make any difference what order these blocks are in my .htaccess file either.

    Don't know if you'd call this a bug, but there must be some way for WordPress and a node.js app using socket.io to exist on the same domain? Or not?

    Kevin

    0
  • cPRex Jurassic Moderator

    I actually don't think having two types of content on the domain is intended in a cPanel environment.  When you start using Node for things, you're all in.

    0

Please sign in to leave a comment.