简体   繁体   中英

Apache Reverse Proxy: (Keeping Existing route alive)

I have an app running on localhost:3000 . I also have another app that is configured to run on virtualhost local.testserver.com

I want to create an apache reverse proxy that will route all request from local.testserver.com/finance to my app that runs at localhost:3000 . At the same time, I want to be able to access my app when I go to localhost:3000 .

Below is the configuration I am using currently. This works for routing request from local.testserver.com/finance to my localhost:3000 app. But whenever I visit localhost:3000 directly it redirects me back to local.testserver.com

<Location /finance >
    ProxyPass http://localhost:3000
    ProxyPassReverse http://localhost:3000
</Location>

You will need to add the path on the ProxyPassReverse setting to "/finance" so it knows where to reverse requests back.

You may not need the <Location /finance>...</Location> part

ProxyPass "/finance" http://localhost:3000
ProxyPassReverse "/finance" "http://localhost:3000"

Please refer to the documentation to better understand how ProxyPassReverse works here:

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassreverse

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM