處理apache反向代理中的位置標頭

處理apache反向代理中的位置標頭

我正在使用 Apache/2.4.29 (Ubuntu) 並將其配置為內部 Web 伺服器的反向代理伺服器。我的反向代理伺服器位址是 10.0.0.1,它是公開的,我的內部伺服器位址是 192.168.1.15,它是一個私人伺服器。虛擬主機設定檔如下所示。

ServerName      web.example.com
ServerAlias     web.example.com
ProxyRequests off
ProxyPreserveHost On
ProxyPass / http://192.168.1.15/web/public/
ProxyPassReverse / http://192.168.1.15/web/public/
ProxyPassReverseCookiePath / /
<Location "/">
Order allow,deny
Allow from all
</Location>
ErrorLog ${APACHE_LOG_DIR}/web-error.log
CustomLog ${APACHE_LOG_DIR}/web-access.log combined

預期結果:http://web.example.com和實際結果:http://web.example.com/web/public/

當我捲曲 URL 時.. $curl -vhttp://web.example.com

Trying 10.0.0.1...
TCP_NODELAY set
Connected to web.example.com (10.0.0.1) port 80 (#0)
GET / HTTP/1.1
Host: web.example.com
User-Agent: curl/7.58.0
Accept: /
HTTP/1.1 302 Found
Date: Sun, 30 Aug 2020 13:28:09 GMT
Server: Apache/2.4.29 (Ubuntu)
Cache-Control: no-cache, private
Location: http://web.example.com/web/public/
Content-Length: 522
Content-Type: text/html; charset=UTF-8

相關內容