class ASF::HTTPS_workarounds
Apache httpd on the original whimsy-vm was behind a proxy that converts https requests into http requests. Update the environment variables to match. This middleware is likely now obsolete.
Public Class Methods
new(app)
click to toggle source
capture the app
# File lib/whimsy/asf/rack.rb, line 234 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
if HTTPS
is set in the environment, rewrite the SCRIPT_URI
and SERVER_PORT
; and strip index.html
from the PATH_INFO
and SCRIPT_URI
.
# File lib/whimsy/asf/rack.rb, line 241 def call(env) if env['HTTPS'] == 'on' env['SCRIPT_URI'].sub!(/^http:/, 'https:') env['SERVER_PORT'] = '443' # for reasons I don't understand, Passenger on whimsy doesn't # forward root directory requests directly, so as a workaround # these requests are rewritten and the following code maps # the requests back: if env['PATH_INFO'] == '/index.html' env['PATH_INFO'] = '/' env['SCRIPT_URI'] += '/' end end return @app.call(env) end