FIX: handle CORS in hijacked requests

This commit is contained in:
Sam
2017-12-07 10:30:50 +11:00
parent c64774f4f8
commit 90a55d6f7c
3 changed files with 85 additions and 34 deletions

View File

@ -55,6 +55,11 @@ module Hijack
body = response.body
headers = response.headers
# add cors if needed
if cors_origins = env_copy[Discourse::Cors::ORIGINS_ENV]
Discourse::Cors.apply_headers(cors_origins, env_copy, headers)
end
headers['Content-Length'] = body.bytesize
headers['Content-Type'] = response.content_type || "text/plain"
headers['Connection'] = "close"