upstream ka-test { zone ka-shm 64k; server 127.0.0.1:8080 max_conns=1000; keepalive 64; } upstream self { zone self-shm 64k; server 127.0.0.1:82 max_conns=1000; keepalive 64; } server { listen 81 default_server; listen [::]:81 default_server; server_name _; access_log off; location / { proxy_pass http://self; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_ignore_client_abort on; } location /direct { proxy_pass http://ka-test; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_ignore_client_abort on; } location /redirect { try_files /non.existant /direct; } location /auth { auth_request /direct; proxy_pass http://self; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_ignore_client_abort on; } location /additions { add_after_body /direct; addition_types *; proxy_pass http://self; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_ignore_client_abort on; } location /mirror { # Mirror doesn't trigger on a return, so we'll pass to ourselves mirror /direct; mirror_request_body off; proxy_pass http://self; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_ignore_client_abort on; } location /error { error_page 404 =200 /direct; return 404; } } server { listen 82; access_log off; location / { return 200 "AB"; } }