Welcome! Log In Create A New Profile

Advanced

Re: Problem using `proxy_redirect` to rewrite the same Location 2-or-more times?

Francis Daly
December 18, 2017 05:28PM
On Fri, Dec 08, 2017 at 08:48:55PM +0000, Alec Muffett wrote:

Hi there,

I have not tested this, but it looks like you might already have the
answer...

> - the origin responds with a 302:
>
> "Location: http://www.foo.com/" ...or
> "Location: http://www.bar.com/" ...or
> "Location: http://www.baz.com/"
>
> ...and I have the following dynamic rewriting that I want to perform:
>
> * foo.com -> ding.org
> * bar.com -> dong.org
> * baz.com -> dell.org
> * ...more?

> The issue seems to be that `proxy_redirect` stops after executing the first
> rule that succeeds?
>
> Is this intended behaviour, please? And is there a way to achieve what I
> want, e.g. via options-flags or Lua? I am making heavy use of subs_filter,
> proxy_cookie_domain, etc.

I do not know if that stop-on-first-match is the intended behaviour. (But
I suspect that proxy_redirect expects to be called in a much simpler
scenario than yours.)

You do currently have a header_filter_by_lua_block{} section, where you
appear to rewrite three specific content-security-related headers based
on multiple regex matches.

Could you not do exactly the same with the "Location" header, since it
is just another header from upstream that will be sent to the client?

It seems so obvious that I guess you must have tried it; but you didn't
explicitly say that you did, so maybe it is worth a shot.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problem using `proxy_redirect` to rewrite the same Location 2-or-more times?

Alec Muffett December 08, 2017 03:52PM

Re: Problem using `proxy_redirect` to rewrite the same Location 2-or-more times?

Francis Daly December 18, 2017 05:28PM

Re: Problem using `proxy_redirect` to rewrite the same Location 2-or-more times?

Alec Muffett December 19, 2017 03:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready