mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
core - fix cors tests with the preflight request
This commit is contained in:
parent
dbb8840992
commit
1d126e1d0e
2 changed files with 5 additions and 3 deletions
|
@ -17,6 +17,7 @@ services:
|
|||
LOG_LEVEL: "info"
|
||||
GENERATE_SELF_SIGNED_SSL: "no"
|
||||
ALLOWED_METHODS: "GET|POST|HEAD|OPTIONS"
|
||||
CUSTOM_CONF_SEVER_HTTP_main: "location /options { default_type 'text/plain'; content_by_lua_block { if ngx.var.request_method == \"OPTIONS\" then ngx.say(\"Hello, world!\") end } }"
|
||||
|
||||
# ? CORS settings
|
||||
USE_CORS: "no"
|
||||
|
|
|
@ -113,19 +113,20 @@ try:
|
|||
sleep(1)
|
||||
|
||||
print(
|
||||
f"ℹ️ Sending a preflight request to http{'s' if ssl else ''}://www.example.com ...",
|
||||
f"ℹ️ Sending a preflight request to http{'s' if ssl else ''}://www.example.com/options ...",
|
||||
flush=True,
|
||||
)
|
||||
|
||||
response = options(
|
||||
f"http{'s' if ssl else ''}://www.example.com",
|
||||
f"http{'s' if ssl else ''}://www.example.com/options",
|
||||
headers={
|
||||
"Host": "www.example.com",
|
||||
"Origin": f"http{'s' if ssl else ''}://bwadm.example.com",
|
||||
},
|
||||
verify=False,
|
||||
)
|
||||
response.raise_for_status()
|
||||
if response.status_code != 404:
|
||||
response.raise_for_status()
|
||||
|
||||
if use_cors:
|
||||
if (
|
||||
|
|
Loading…
Reference in a new issue