Node.js app in subpath with Apache 2.4

I have an Ubuntu 14.04 x86 droplet on DigitalOcean with Apache 2.4.7 (the default from Ubuntu repositories). Also, I have a Node.js app running on port 3000, and want to map /node* path on root to /* the Node.js server (using Express).

What I tried:

  • Enabled mod_proxy with a2enmod proxy.
  • Modify /etc/apache2/sites-available/000-default.conf and added a line with ProxyPass /node http://localhost:3000/ to the end of VirtualHost.

What I get:

  • /node proxied to http://localhost:3000/.
  • /node/help proxied to http://localhost:3000/ (which is not right).

Are there any other modifications I should do in order to do that? Thanks in advance!

-1
задан 12 April 2017 в 12:57
1 ответ

Выяснилось, что в Express установлена ​​ строгая маршрутизация , которая, например, не допускает // help .

Решение: Опустите завершающую косую черту в директиве ProxyPass , например:

ProxyPass /node http://localhost:3000
0
ответ дан 5 December 2019 в 20:25

Теги

Похожие вопросы