Skip to content

Instantly share code, notes, and snippets.

@vladshub
Last active July 31, 2018 20:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladshub/18b7c5d340d963f1de9628abb46a48b2 to your computer and use it in GitHub Desktop.
Save vladshub/18b7c5d340d963f1de9628abb46a48b2 to your computer and use it in GitHub Desktop.
nginx auth_request doesn't post :(
#!/bin/bash
while true ; do echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -l -p 1501 ; done
#!/bin/bash
while true ; do echo -e "HTTP/1.1 200 OK\n\n $(date)" | nc -l -p 1500 ; done
server {
listen 80;
server_name localhost;
auth_request /auth;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /api {
proxy_pass "http://127.0.0.1:1501/";
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location = /auth {
internal;
proxy_pass "http://127.0.0.1:1500/";
proxy_pass_request_body on;
proxy_pass_request_headers on;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Method $request_method;
proxy_set_header Host $http_host;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment