When the frontend receives a request without an origin header the script craches on line 100 (local origin = headers["origin"][0]).
Because headers["origin"] = nil so asking an index from nil.
function cors_request(txn, allowed_methods, allowed_origins, allowed_headers)
local headers = txn.http:req_get_headers()
local transaction_data = {}
if headers["origin"] ~= nil and headers["origin"][0] ~= nil then
core.Debug("CORS: Got 'Origin' header: " .. headers["origin"][0])
transaction_data["origin"] = headers["origin"][0]
end
transaction_data["allowed_methods"] = allowed_methods
transaction_data["allowed_origins"] = allowed_origins
transaction_data["allowed_headers"] = allowed_headers
txn:set_priv(transaction_data)
local method = txn.sf:method()
transaction_data["method"] = method
if method == "OPTIONS" and txn.reply ~= nil then
preflight_request_ver2(txn, origin, allowed_methods, allowed_origins, allowed_headers)
end
end