(Please excuse my English)
I'm writing a Nginx configuration file using 'if' statement.
Below is a part of the configuration file and it works well.
---
set $destination $http_destination;
set $scheme_host "$scheme://$host"; # $scheme_host = "https://your.host.com"
.......
.......
if ($destination ~ ^https://your.host.com/(.*)$) {
set $temp $1;
}
---
However, when I changed the above 'if' clause like below, but it did not work.
It seems that variables cannot be used in the regular expression.
---
if ($destination ~ ^\$scheme_host/(.*)$) {
set $temp $1;
}
---
How can I use variables in the regular expression?
Or write configuration works the same way?
I'm writing a Nginx configuration file using 'if' statement.
Below is a part of the configuration file and it works well.
---
set $destination $http_destination;
set $scheme_host "$scheme://$host"; # $scheme_host = "https://your.host.com"
.......
.......
if ($destination ~ ^https://your.host.com/(.*)$) {
set $temp $1;
}
---
However, when I changed the above 'if' clause like below, but it did not work.
It seems that variables cannot be used in the regular expression.
---
if ($destination ~ ^\$scheme_host/(.*)$) {
set $temp $1;
}
---
How can I use variables in the regular expression?
Or write configuration works the same way?