Evo.Auth/example/nginx.conf
Chika 264d673019 fix authentication
add example nginx.conf
2022-11-30 18:46:08 +03:00

55 lines
1.2 KiB
Nginx Configuration File

worker_processes 4;
events {
worker_connections 1024;
}
http {
upstream auth_server {
server auth_server:80;
}
upstream application {
server application:3000;
}
server {
listen 80;
include /etc/nginx/mime.types;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
error_page 401 /login;
location = /auth {
internal;
proxy_pass http://auth_server;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
}
location ~ ^/(login|signin|logout|get-user) {
proxy_pass http://auth_server;
}
location / {
auth_request /auth;
auth_request_set $auth_cookie $upstream_http_set_cookie;
add_header Set-Cookie $auth_cookie;
proxy_pass http://application/;
}
}
}