Skip to content

Instantly share code, notes, and snippets.

@willread
Last active August 29, 2015 14:07
Show Gist options
  • Save willread/670d717ccca32e4f2131 to your computer and use it in GitHub Desktop.
Save willread/670d717ccca32e4f2131 to your computer and use it in GitHub Desktop.
Authenticating static files in nginx with a REST api
location / {
proxy_pass http://localhost:3000;
auth_request /api-qa/user;
}
error_page 401 /auth.html;
error_page 403 /auth.html;
location ~ /api|api|auth|css|fonts|favicon|images/ {
auth_request off;
proxy_pass http://localhost:3000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment