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:
Sam
2014-10-24 13:38:00 +11:00
parent 1962563c31
commit aa9b3bb35a
8 changed files with 53 additions and 4 deletions

View File

@ -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]