[kwlug-disc] nginx config question
Ronald Barnes
ron at ronaldbarnes.ca
Thu Sep 28 23:04:36 EDT 2023
Chris Frey wrote on 2023-09-28 09:32:
> I would suggest putting your 301 inside a location block that comes
> last. In this case it would be:
>
> location / { return 301
> https://$host$request_uri;
> }
>
> Your /ping would match ahead of this,
> because it is longer. And any regex-based locations would match ahead of
> /ping because they come earlier in the search order. And you still have
> = and ^~ to use if you need to make sure one of the locations needs
> priority behaviour over even the regex locations.
Ah, that's the trick.
The 301 in a location at the end, plus I am playing with "=" vs prefix
matching "/ping" as well, but it all works now.
> Hope that helps,
Yeah, that made the light bulb turn on and I suddenly realized what I
already knew but couldn't seem to put together on my own.
Thanks!
And thanks to Mikalai for his reply too.
rb
More information about the kwlug-disc
mailing list