I'm running a webapp on local using gunicorn on 127.0.0.1:8000. I want to make its service-page /demo accessible on http://127.0.0.1/internal and rewrite all calls to /demo to internal
I'm using Apache v2.4.
Several approaches using mod_proxy and mod_rewrite.
# This gives me `ERR_TOO_MANY_REDIRECTS`. <Location /internal> ProxyPass http://localhost:8000/demo ProxyPassReverse http://localhost:8000/demo RequestHeader add X-Script-Name "/internal" </Location> # This works, but I need to visit /internal/demo manually. <Location /internal> ProxyPass http://localhost:8000 ProxyPassReverse http://localhost:8000 RequestHeader add X-Script-Name "/internal" </Location> It doesn't matter, where to place the ProxyPass...
ProxyPass /internal http://localhost:8000 ProxyPassReverse /internal http://localhost:8000 <Location /internal> RequestHeader add X-Script-Name "/internal" </Location> According to the developer, RequestHeader add X-Script-Name is supported.
Using NGINX, this works as expected:
location /internal { proxy_pass http://localhost:8000; proxy_set_header Host $http_host; proxy_set_header X-Script-Name /internal; rewrite /internal$ /internal/demo redirect; } But adding this to Apache2 doesn't help:
RewriteRule /internal$ /internal/demo [R,L]