Skip to content

Commit 5486156

Browse files
authored
Fix passing origin to preflight_request_ver2
1 parent efecc07 commit 5486156

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/cors.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,14 @@ end
9898
function cors_request(txn, allowed_methods, allowed_origins, allowed_headers)
9999
local headers = txn.http:req_get_headers()
100100
local transaction_data = {}
101+
local origin = nil
101102

102103
if headers["origin"] ~= nil and headers["origin"][0] ~= nil then
103104
core.Debug("CORS: Got 'Origin' header: " .. headers["origin"][0])
104-
transaction_data["origin"] = headers["origin"][0]
105+
origin = headers["origin"][0]
105106
end
106-
107+
108+
transaction_data["origin"] = origin
107109
transaction_data["allowed_methods"] = allowed_methods
108110
transaction_data["allowed_origins"] = allowed_origins
109111
transaction_data["allowed_headers"] = allowed_headers

0 commit comments

Comments
 (0)