mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +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:
parent
1962563c31
commit
aa9b3bb35a
8 changed files with 53 additions and 4 deletions
|
@ -18,6 +18,17 @@ class Auth::DefaultCurrentUserProvider
|
|||
def current_user
|
||||
return @env[CURRENT_USER_KEY] if @env.key?(CURRENT_USER_KEY)
|
||||
|
||||
# bypass if we have the shared session header
|
||||
if shared_key = @env['HTTP_X_SHARED_SESSION_KEY']
|
||||
uid = $redis.get("shared_session_key_#{shared_key}")
|
||||
user = nil
|
||||
if uid
|
||||
user = User.find_by(id: uid.to_i)
|
||||
end
|
||||
@env[CURRENT_USER_KEY] = user
|
||||
return user
|
||||
end
|
||||
|
||||
request = @request
|
||||
|
||||
auth_token = request.cookies[TOKEN_COOKIE]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue