upstream app { # Path to Puma socket server localhost:9292; } # Send either X-Forwarded for or the actual scheme to the upsteam map $http_x_forwarded_proto $app_proto { default $http_x_forwarded_proto; '' $scheme; }