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
Source
# File lib/whimsy/asf/rack.rb, line 234 def initialize(app) @app = app end
capture the app
Public Instance Methods
Source
# 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
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
.