Rewrite mirrored request
Jurian Broertjes
jurian.broertjes at openindex.io
Tue May 29 09:18:26 UTC 2018
Hi Roman,
Thank you for your answer, but it's not clear to me how to do this.
The request I'd like to mirror is something like
http://solrproxy.example.org/prd-solr/abc/select?xyz, so I would expect
the "prd-solr" part to be rewritten for the mirror requests. The log says:
"GET /prd-solr/abc/select?xyz HTTP/1.0
Host: cloud
Do you have a suggestion on how to get it to "/solr/abc/select?xyz
Best regards,
Jurian
On 28-05-18 17:50, Roman Arutyunyan wrote:
> 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.
>
More information about the nginx
mailing list