Rewrite mirrored request
Roman Arutyunyan
arut at nginx.com
Mon May 28 15:50:41 UTC 2018
Hello Jurian,
On Mon, May 28, 2018 at 03:38:45PM +0200, Jurian Broertjes wrote:
> Hi All,
>
> I'm trying to do a simple rewrite of a mirrored request, see the snippet
> below. I'm under the impression that mirrored requests somehow cannot be
> rewritten. Is this the case or am I doing something wrong here? Is there
> some other way to get the job done?
>
> location / {
> mirror /mirror;
> ....
> proxy_pass http://slave;
> }
>
> location /mirror {
> internal;
>
> rewrite prd-solr solr;
> proxy_pass http://cloud;
> }
Mirror requests can be rewritten. But keep in mind that a mirror subrequest
has a different URI than the original request. In your case it's /mirror.
So unless 'prd-solr' matches it, rewrite will not happen.
Normally $request_uri is used to access the original request URI in a mirror
subrequest.
--
Roman Arutyunyan
More information about the nginx
mailing list