Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Created October 1, 2015 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdunogier/81bc58040b3a6b960e5d to your computer and use it in GitHub Desktop.
Save bdunogier/81bc58040b3a6b960e5d to your computer and use it in GitHub Desktop.
Symfony env depending on a cookie

Add this URL as a bookmark, with 'dev' replaced with the environment to switch to. Repeat for each env.

javascript:(/** @version 0.5.2 */function() {document.cookie='env=dev;path=/;';})()
server {
location / {
set $env "dev";
if ($http_cookie ~* "env=([^;]+)(?:;|$)") {
set $env $1;
}
fastcgi_param ENVIRONMENT $env;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment