mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:01:20 +08:00
FEATURE: allow long polling to go to a different url
Added the site setting long_polling_base_url , this allows you to farm long polling to a different server. This setting is very important if a CDN is serving dynamic content.
This commit is contained in:
@ -11,6 +11,17 @@ module ApplicationHelper
|
||||
include CanonicalURL::Helpers
|
||||
include ConfigurableUrls
|
||||
|
||||
def shared_session_key
|
||||
if SiteSetting.long_polling_base_url != '/'.freeze && current_user
|
||||
sk = "shared_session_key"
|
||||
return request.env[sk] if request.env[sk]
|
||||
|
||||
request.env[sk] = key = (session[sk] ||= SecureRandom.hex)
|
||||
$redis.setex "#{sk}_#{key}", 7.days, current_user.id.to_s
|
||||
key
|
||||
end
|
||||
end
|
||||
|
||||
def script(*args)
|
||||
if SiteSetting.enable_cdn_js_debugging && GlobalSetting.cdn_url
|
||||
tags = javascript_include_tag(*args, "crossorigin" => "anonymous")
|
||||
|
Reference in New Issue
Block a user