mirror of
https://github.com/odoocker/odoocker
synced 2025-12-22 04:59:32 +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;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
nginx-proxy/nginx.conf
Normal file
37
nginx-proxy/nginx.conf
Normal file
@@ -0,0 +1,37 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 10240;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
|
||||
keepalive_timeout 900;
|
||||
|
||||
proxy_connect_timeout 900;
|
||||
proxy_send_timeout 900;
|
||||
proxy_read_timeout 900;
|
||||
send_timeout 900;
|
||||
|
||||
client_max_body_size 1024m;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/cors.conf;
|
||||
|
||||
}
|
||||
|
||||
daemon off;
|
||||
Reference in New Issue
Block a user