mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 00:40:56 -05:00
More fixes for geoip stuff.
This commit is contained in:
parent
79ea3258f1
commit
b8da7f547f
1 changed files with 1 additions and 1 deletions
|
@ -84,7 +84,7 @@ setupChinaRedirectMiddleware = (app) ->
|
|||
speaksChinese = firstLanguage and firstLanguage.indexOf('zh') isnt -1
|
||||
unless config.tokyo
|
||||
ip = req.headers['x-forwarded-for'] or req.connection.remoteAddress
|
||||
ip = ip?.split(' ')[0] # If there are two IP addresses, say because of CloudFlare, we just take the first.
|
||||
ip = ip?.split(/,? /)[0] # If there are two IP addresses, say because of CloudFlare, we just take the first.
|
||||
geo = geoip.lookup(ip)
|
||||
if speaksChinese or geo?.country is "CN"
|
||||
log.info("Should we redirect to Tokyo server? speaksChinese: #{speaksChinese}, firstLanguage: #{firstLanguage}, ip: #{ip}, geo: #{geo} -- so redirecting? #{geo?.country is 'CN' and speaksChinese}")
|
||||
|
|
Loading…
Reference in a new issue