Sorry, I'm not exactly sure about what you need here..
Can you be a little more specific?
It was working before you change your hosting?
Are you using an external provider? Like sendgrid? Or what?
Sorry, I'm not exactly sure about what you need here..
Can you be a little more specific?
It was working before you change your hosting?
Are you using an external provider? Like sendgrid? Or what?
It sounds like the hosting environment might be treating your NodeJS app like static content or a PHP-based site, rather than executing it as a live server process. That would explain why the server is responding with Content-Type: text/html; charset=utf-8 instead of JSON, and why the client’s Accept: application/json header is triggering a 406 error.
This kind of mismatch often happens when a NodeJS app is uploaded to a shared hosting provider (like A2 Hosting) without configuring a proper Node runtime or process manager (e.g., PM2 or a custom start script). Traditional servers like Apache or Nginx don’t automatically run Node apps, they need to be explicitly told to proxy requests to a running Node process.
You might want to double-check:
Is the NodeJS app actually running as a server via node index.js?
Is the hosting environment configured to route requests to that process (via reverse proxy or port binding)?
Or is the server just serving static files from the Node project folder?
If it’s the latter, the server will default to HTML responses, and any dynamic API logic won’t execute, hence the 406.
I want the Joomla site to load first when I visit the website in the browser. Currently, the app when it is running ,which is the login page for the members section, loads as the default index page. Instead, I want the Joomla homepage to load initially, and then provide a link on that page to access the app's members section. Mail is working now- thanks.
Hi Ben: thanks for your reply. As I told Franz I added the following to the htaccess file and now the app functions correctly.
RewriteBase /mydirectory.mysite.com
# Check if the requested URI starts with /api
RewriteCond %{REQUEST_URI} ~/api(.*)
# Proxy the request to the Node js server running on port 3000
RewriteRule "api/ (.*)$ http://localhost:3000/$1 1P,L!
# Make sure Apache does not try to serve local files for the Node.js path
ProxyPassReverse /api/ http://localhost: 3000/
I want the Joomla site to load first when I visit the website in the browser. Currently, the app when it is running ,which is the login page for the members section, loads as the default index page. Instead, I want the Joomla homepage to load initially, and then provide a link on that page to access the app's members section. Thanks
You could make use of routing (if enabled in your Node Project) to do this and set the route path for the index page, which will be by default ‘/’, and have this route forward to the URL of the Joomla page setting the ‘type’ of route to either ‘redirect’ or ‘page’ and then specify the page to direct to. Remember you will need to amend the route for the app’s current index (the Node index) to reflect this change so you don’t have any conflicts.
Can you clarify. Are you trying to run Joomla (a PHP app) and node.js code on the same server?
Yes
I dont think that will technology mix can work.
There is no problem running Joomla and NodeJS on the same physical server. The way that @webdesignBCMS has done that using .htaccess is the way to go when using Apache as the reverse proxy.
I have most of my Node sites running under Nginx mainly to serve the static files (images, CSS and JS) while NodeJS focusses on the dynamic delivery.
Yes, i get the server can run both on the server itself, certainly Plesk and cPanel cater for that. Perhaps I extressed myself badly, what I meant was within the same application rather than generically on the server .
Can a node application for instance, also have PHP files within it or the converse was the intended question?