Hello,
I have something in one of my server bloc:
```
# switch to TLS for page.php, contact.php, faq.php, known https sources and /
if ($scheme = http) {
set $rule_9 1$rule_9;
}
if ($outdated = 0){
set $rule_9 2$rule_9;
}
if ($request_uri ~ "^/(auction|biglemon|carview(-bike)?|carsensor(-c)?|daihatsu|gazoo|goo(bike(-catalog)?|net)|honda|koubai|kuriyama-truck|kurumaerabi(-search)?|truck-reparts(-b)?|truskey|list1|pdns|rakuten|page|faq|contact(_japan)?|jpa(-b|L1)?|_jpa[23])\.php|^/(\?.*)?$") {
set $rule_9 3$rule_9;
}
if ($rule_9 = "3210"){
return 301 https://www.server.com$request_uri;
}
```
Then something similar in another
```
# switch to TLS for page.php, contact.php, faq.php, known https sources and /
if ($scheme = http) {
set $rule_9 1$rule_9;
}
if ($outdated = 0){
set $rule_9 2$rule_9;
}
if ($request_uri ~ "^/(auction|biglemon|carview(-bike)?|carsensor(-c)?|daihatsu|gazoo|goo(bike(-catalog)?|net)|honda|koubai|kuriyama-truck|kurumaerabi(-search)?|truck-reparts(-b)?|truskey|list1|pdns|rakuten|page|faq|contact(_japan)?|jpa(-b|L1)?|_jpa[23])\.php|^/(\?.*)?$") {
set $rule_9 3$rule_9;
}
if ($rule_9 = "3210"){
return 301 https://dev.server.com$request_uri;
}
```
The problem is that have several servers.
1 - Is there a way to use variable for the some server names in the 'return 301' line so I could use shared code and not have to edit this snippet everywhere another site turns https?
2 - I have a lot of those return 301 where code could be shared if something like this were available e.g. $scheme://$actual_real_server_name$request_uri
Difficulty, the server_name can and often contains multiple entries.
I have found nothing useful about this on serverfault nor anywhere else. Dealing with this for several years.
Thanks!