Maxim Dounin
July 27, 2017 06:32AM
Hello!

On Thu, Jul 27, 2017 at 03:55:40AM -0400, foxgab wrote:

> i want to change the redirect location URI protocol to https if that is
> using, so i tried to configure like this:
>
> proxy_redirect ~*^http://$host(/.*)?$ $scheme://$host$1;
>
> but that didn't work, so i change it to:
>
> proxy_redirect http://$http_host $scheme://$http_host;
>
> then, it works. I suspect that the variable in regular expressions is treat
> as a string, hence my former directive failed, am I right?
> Is there any way to make variables effect in regular expressions?

No. Regular expressions are compiled during configuration
parsing, and using variables in them is not possible.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

can variables be used in regular expressions?

foxgab July 27, 2017 03:55AM

Re: can variables be used in regular expressions?

Maxim Dounin July 27, 2017 06:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 242
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