简体   繁体   中英

Redirect URL to a new server, fixing a new URL

Structure:

http://192.168.123.123:80 (Apache)

http://192.168.123.123:8001/admin (Gunicorn + Docker)

My Apache (it works):

ProxyPass /admin http://127.0.0.1:8001/admin

ProxyPassReverse /admin http://127.0.0.1:8001/admin

I need every redirect to Gunicorn, go with the URL NEW:

http://192.168.123.123/NEW/admin

I can redirect, but Django understands that NEW is his:

"The current path, NEW/admin, didn't match any of these"

Solution:

ProxyPass http://127.0.0.1:8001/NEW/

ProxyPassReverse http://127.0.0.1:8001/NEW/

RequestHeader set SCRIPT_NAME /NEW

RequestHeader set X-FORWARDED-PROTOCOL ssl

RequestHeader set X-FORWARDED-SSL on

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