Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
if ($host ~* {
set $test "${test}B";
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
if ($test = ABC) {
Copy link

boddumanohar commented Mar 13, 2020

this is awesome!

Copy link

GoodJob commented Mar 17, 2021

Need explanation.... what actually this does:
if ($host ~* {
set $test "${test}";
Does it takes "this" or what? Thanks!

How to write this condition?

if ($host * {
set $subdomain_name = ?;


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment