Skip to content

Instantly share code, notes, and snippets.

@grimen
Last active January 6, 2016 21:15
Show Gist options
  • Save grimen/dffbc23174cfb33f399f to your computer and use it in GitHub Desktop.
Save grimen/dffbc23174cfb33f399f to your computer and use it in GitHub Desktop.
location /validate {
# IF:
# /validate?param1=value
# /validate?param0=x&param1=value
rewrite ^/validate?.*param1\=(.+).*$ /success/$1 last;
# ELSE:
# /validate?param0=x
# /validate?param0=x&param1
# /validate?param0=x&param1=
rewrite ^/validate?.*$ /fail last;
# FALLBACK: Not a case, but just for the cause...
return 403;
}
location ~ /fail {
return 400;
}
location ~ /success/(.+) {
return 200 $1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment