mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
18 lines
355 B
Ruby
18 lines
355 B
Ruby
|
# tiny middleware to force https if needed
|
||
|
class Discourse::ForceHttpsMiddleware
|
||
|
|
||
|
def initialize(app, config={})
|
||
|
@app = app
|
||
|
end
|
||
|
|
||
|
def call(env)
|
||
|
env['rack.url_scheme'] = 'https' if SiteSetting.use_https
|
||
|
@app.call(env)
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
|
||
|
Rails.configuration.middleware.insert_before MessageBus::Rack::Middleware, Discourse::ForceHttpsMiddleware
|
||
|
|