I have a Rails app being served on standalone Passenger behind an nginx proxy. Because of this setup, the environment hash needs a bit of tweaking to work with a piece of rack middleware we're using (rack-cas). Specifically I have to set env['SERVER_PORT'] = '443'
and env['HTTPS'] = 'on'
in the middleware's call method (we don't want Passenger using SSL, would rather the nginx proxy handle it).
I can do all that easy enough in the middleware but can I do it in the Rails app so I don't have to customize the middleware?
Turns out it can all be done from the nginx proxy's config, don't have to touch the app or middleware at all: