mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 00:40:56 -05:00
Redirect with same protocol as request
Try using // instead of explicit protocol
This commit is contained in:
parent
bbe4a0540d
commit
c24e81aebb
1 changed files with 2 additions and 2 deletions
|
@ -62,9 +62,9 @@ setupDomainFilterMiddleware = (app) ->
|
|||
domainRegex = new RegExp("(.*\.)?(#{config.mainHostname}|#{config.unsafeContentHostname})")
|
||||
domainPrefix = req.host.match(domainRegex)?[1] or ''
|
||||
if _.any(unsafePaths, (pathRegex) -> pathRegex.test(req.path)) and (req.host isnt domainPrefix + config.unsafeContentHostname)
|
||||
res.redirect('http://' + domainPrefix + config.unsafeContentHostname + req.path)
|
||||
res.redirect('//' + domainPrefix + config.unsafeContentHostname + req.path)
|
||||
else if not _.any(unsafePaths, (pathRegex) -> pathRegex.test(req.path)) and req.host is domainPrefix + config.unsafeContentHostname
|
||||
res.redirect('http://' + domainPrefix + config.mainHostname + req.path)
|
||||
res.redirect('//' + domainPrefix + config.mainHostname + req.path)
|
||||
else
|
||||
next()
|
||||
|
||||
|
|
Loading…
Reference in a new issue