node.js - How to have a node app working with proper URL on port 80 -


i saw lot of questions handling seems problem in fact not. first, i'll explain problem, tell saw on internet (including stackoverflow) , explain why doesn't apply.

1. situation

i have virtualhost on apache. here conf:

serveradmin xxx@xxx.xxx servername example.com  <virtualhost *:80>   documentroot /var/html/   <location /redmine>     railsenv production     rackbaseuri /redmin     option -multiviews   </location> </virtualhost> 

when access example.com/redmine, it's ok, i've got redmine. have nodejs app working on port 9114: example.com:9114 shows app correctly. don't want port displayed. in fact, want every example.com/node/xxx redirected example.com:9114/xxx, wihtout changing url.

2. solutions

i have encountered several solutions. first, using mod_rewrite. tested this:

serveradmin xxx@xxx.xxx servername example.com  <virtualhost *:80>   documentroot /var/html/   <location /redmine>     railsenv production     rackbaseuri /redmin     option -multiviews   </location>   options +followsymlinks -multiviews   rewriteengine on   rewriterule ^/node/(.*) http://example.com:9114/$1 [l,nc] </virtualhost> 

this not because if enter url example.com/node/particularpage, i'm redirected example.com:9114/particularpage, allows me use app correctly, changes url: user sees there particular port.

the second solution using proxypass:

serveradmin xxx@xxx.xxx servername example.com  <virtualhost *:80>   documentroot /var/html/   <location /redmine>     railsenv production     rackbaseuri /redmin     option -multiviews   </location>   proxypass /node http://example.com:9114   proxypassreverse /node http://example.com:9114 </virtualhost> 

this still not because although example.com/node/particularpage gets me correct page, css, js ans links not correct , can't use app correctly.

my question is: there way, proper apache config and/or use of nodejs middleware (i thought "url"), goal, without changing routes of app?

ah, precision: can't have subdomain, such node.example.com. catch, otherwise wouldn't have posted here ;)

thanks in advance.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -