My mirroring works just fine, and I am correctly getting the original request body in the mirror server.
However I need to access a response header called Location
from the original upstream and forward it to my mirror. Typically the response header from upstream will be accessed using this variable: $upstream_http_<*header name*>
, in my case $upstream_http_location
.
However I want to access this in my mirror so I can forward the response header from my upstream to my mirror.
How do I do this? Here's my current configuration, but it doesn't work and I don't see the header DAV-response
in my mirror. Is there another way to access all $upstream_http
headers in the mirror block?
I have the following request mirroring setup in nginx:
location /ops/opendata/DataAccessViewer/ {
mirror /davmirror;
proxy_pass https://<upstream>/;
proxy_redirect https://<upstream>/ /;
}
location /davmirror {
internal;
proxy_pass https://<mirror>;
proxy_set_header DAV-Original-URI $request_uri; # <<<<-- works!
proxy_set_header DAV-tier internals; # <<<<-- works!
proxy_set_header DAV-response $upstream_http_location; # <<<-- DOESNT WORK!
}
Update
Open to alternative solutions to achieve this using nginx. I am aware of other non-nginx workarounds and in-fact using those as fallbacks at the moment. Ideally we would want this to be nginx solution.
Update This question seems to suggest that nginx is actually waiting on upstream response before resolving mirror?
Update
Verified that upstream does actually include a 'Location' Header:
Here's all the headers I receive in the mirror. Note that DAV-response
is missing