How to configure SSL termination on Nginx with a Rails application -
i ssl request through load balancer performing ssl termination , sending decrypted traffic server on port 81.
i'm running nginx , have setup listener port 81 , tell rails app ssl request.
here how nginx config looks like:
server { listen 81; server_name server; root /var/www/app/current/public; error_log /var/log/nginx/app-error.log; access_log /var/log/nginx/app-access.log; passenger_enabled on; client_max_body_size 100m; location / { passenger_enabled on; proxy_set_header x-forwarded-proto https; } }
it goes through ruby on rails doesn't detect header request.headers['x-forwarded-proto'], takes request non-https. should add in order rails thinking ssl request?
so proxy_set_header not used passenger, need use passenger_set_cgi_param instead:
passenger_set_cgi_param http_x_forwarded_proto https;
Comments
Post a Comment