map $request_method $upstream_location { PUT http://ritsu.midov.pl:80/ ; # this is where the matrix registration is POST http://ritsu.midov.pl:80/ ; # this is captchouli GET http://mugi.midov.pl:80/ ; default http://mugi.midov.pl:80/ ; } server { [...] location /registerform.sh { resolver 10.0.0.3; proxy_pass $upstream_location ; proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect http:// https://; } location /registerform.sh { proxy_pass http://ritsu.midov.pl; proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect http:// https://; } }