mirror of
https://github.com/odoocker/odoocker
synced 2025-11-04 15:19:22 +01:00
first commit
This commit is contained in:
31
nginx-proxy/cors.conf
Normal file
31
nginx-proxy/cors.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
# Allows the usage of $CORS_ALLOWED_DOMAIN
|
||||
map $http_x_cors_allowed_domain $CORS_ALLOWED_DOMAIN {
|
||||
default "*";
|
||||
}
|
||||
|
||||
server {
|
||||
server_name $VIRTUAL_HOST;
|
||||
listen 443;
|
||||
location / {
|
||||
# Set the Access-Control-Allow-Origin header to allow specific domain(s) for CORS
|
||||
add_header 'Access-Control-Allow-Origin' $CORS_ALLOWED_DOMAIN;
|
||||
# Specify the allowed HTTP methods for CORS requests
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
# Define the allowed request headers for CORS requests
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
# Specify the response headers that are accessible by the client (browser)
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
|
||||
# Set the maximum age (in seconds) for the CORS preflight request cache in the client (browser)
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
|
||||
# Handle CORS preflight (OPTIONS) requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
# Set the response content type and charset for the preflight request
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
# Set the response content length to 0 for the preflight request
|
||||
add_header 'Content-Length' 0;
|
||||
# Return a 204 No Content status for the preflight request
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user