I have the following in nginx.conf
:
header_filter_by_lua_block {
ngx.header["Access-Control-Allow-Origin"] = "http://example.com"
}
I want to add another http://example.dev
to the Access-Control-Allow-Origin
. I tried doing http://example.com, http://example.dev
but it didn't work.
I also tried doing:
if ($http_origin ~* "^http?://(example.com|example.dev)$") {
add_header Access-Control-Allow-Origin "$http_origin";
}
But this made some issue in OPTIONS
request so I really can't use this. Is there any other way to do inside header_filter_by_lua_block
? Please help.