Guillaume "B.B." Van Hemmen
6e94306755
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit introduces the Nginx setup by using the official Nginx Alpine image and copying the custom Nginx configuration into the Docker container. It also includes CORS headers in the Nginx configuration to allow requests from any origin with specific headers and methods.
27 lines
1 KiB
Nginx Configuration File
27 lines
1 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name yourdomain.com;
|
|
|
|
location / {
|
|
# other settings...
|
|
|
|
# Allow CORS for all domains (or specify a particular domain instead of *)
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
|
|
# Allow specific headers
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
|
|
|
|
# Allow specific methods
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
add_header 'Content-Length' 0;
|
|
return 204;
|
|
}
|
|
}
|
|
}
|