简体   繁体   English

使用 mod_proxy 进行反向代理,保留原始请求 URL

[英]Reverse proxy with mod_proxy, preserve original request URL

I've configured a reverse proxy using mod_proxy (Apache2) listening on 127.0.0.1:80, that proxies all the request to 127.0.0.1:8080我使用 mod_proxy (Apache2) 配置了一个反向代理,监听 127.0.0.1:80,将所有请求代理到 127.0.0.1:8080

So I've configured mod_proxy like:所以我配置了 mod_proxy 像:

ProxyPreserveHost On
ProxyRequests Off
ProxyPass /foo http://127.0.0.1:8080
ProxyPassReverse /foo http://127.0.0.1:8080

When I request http://127.0.0.1/foo/bar , the app listening on 127.0.0.1:8080 gets the following request URL from mod_proxy:当我请求http://127.0.0.1/foo/bar时,监听 127.0.0.1:8080 的应用程序从 mod_proxy 收到以下请求 URL:

http://127.0.0.1/bar http://127.0.0.1/bar

Instead I'd like to preserve the original request, and get:相反,我想保留原始请求,并获得:

http://127.0.0.1/foo/bar http://127.0.0.1/foo/bar

How can I do this?我怎样才能做到这一点?

Fixed with:固定:

ProxyPreserveHost On
ProxyRequests Off
ProxyPass /foo http://127.0.0.1:8080/foo
ProxyPassReverse /foo http://127.0.0.1:8080/foo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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