If you want redirect all, you could use this way:
location / {
proxy_pass http://127.0.0.1:8080/VirtualHostBase/https/$server_name:443/some/path/VirtualHostRoot;
}
Your examples could need the combination of rewrite
and proxy_pass
:
location / {
rewrite ^(.*)$ /VirtualHostBase/https/$server_name:443/some/path/VirtualHostRoot$1 break;
proxy_pass http://127.0.0.1:8080;
}
Warning: you have got different rewrite redirect
effect: break
returns 301 instead permanent
returns 302.
EDIT
Upstream this module/s you need use proxy_cache_valid
diretive:
proxy_cache_valid 301 1h;
Warning, upstream cache-related directives have priority over proxy_cache_valid value, in particular the order is:
- X-Accel-Expires
- Expires/Cache-Control
- proxy_cache_valid
Reference: HttpProxyModule, Nginx reverse proxy + URL rewrite