Merge pull request #10 from openwhisk/cors-update
Modify cors response headers
diff --git a/api-gateway-config/scripts/lua/lib/filemgmt.lua b/api-gateway-config/scripts/lua/lib/filemgmt.lua
index ae3f057..25c9cfe 100644
--- a/api-gateway-config/scripts/lua/lib/filemgmt.lua
+++ b/api-gateway-config/scripts/lua/lib/filemgmt.lua
@@ -48,10 +48,8 @@
prefix = utils.concatStrings({prefix, "\tset $apiId ", decoded.apiId, ";\n"})
end
-- Add CORS headers
- local cors = utils.concatStrings({
- "\tadd_header Access-Control-Allow-Origin *;\n",
- "\tadd_header Access-Control-Allow-Credentials true;\n"
- })
+ prefix = utils.concatStrings({prefix, "\tadd_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS';\n"})
+
-- Set resource headers and mapping by calling routing.processCall()
local outgoingResource = utils.concatStrings({
"\taccess_by_lua_block {\n",
@@ -71,7 +69,6 @@
local location = utils.concatStrings({
"location ~ ^/api/", tenant, "/", updatedPath, "(\\b) {\n",
prefix,
- cors,
outgoingResource,
"}\n"
})