Skip to content

Instantly share code, notes, and snippets.

@fab1an
Created February 2, 2017 12:50
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 fab1an/99e5fd48d7ab52349225f2bb80a85941 to your computer and use it in GitHub Desktop.
Save fab1an/99e5fd48d7ab52349225f2bb80a85941 to your computer and use it in GitHub Desktop.
# target server
upstream postgrest {
server localhost:4000;
keepalive 64;
}
# proxy
server {
listen 3000;
# forward /api/* to postgrest
location /api/ {
proxy_pass http://postgrest/;
}
# forward /urlauth/<TOKEN>/* to postgrest and set Authorization-header from URL
location ~ ^/urlauth/(.*)/(.*)$ {
proxy_set_header Authorization "Bearer $1";
proxy_pass http://postgrest/$2$is_args$args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment