stuff
This commit is contained in:
parent
1ccca0fd1a
commit
3941ed3427
5 changed files with 49 additions and 3 deletions
|
|
@ -55,6 +55,18 @@ server {
|
|||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# CORS headers for API
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization, user_token, request_token, app_version" always;
|
||||
add_header Access-Control-Expose-Headers "Authorization" always;
|
||||
add_header Access-Control-Max-Age "86400" always;
|
||||
|
||||
# Handle preflight OPTIONS requests
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
|
||||
# Proxy to HTTP backend (SSL termination in nginx)
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
|
|
|
|||
|
|
@ -162,6 +162,37 @@ EOF
|
|||
root /var/www/html;
|
||||
try_files \$uri =404;
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
api)
|
||||
cat >> "$output_file" << EOF
|
||||
# API Backend specific settings
|
||||
client_max_body_size 100M;
|
||||
|
||||
# CORS headers for API
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization, user_token, request_token, app_version" always;
|
||||
add_header Access-Control-Expose-Headers "Authorization" always;
|
||||
add_header Access-Control-Max-Age "86400" always;
|
||||
|
||||
# Handle preflight OPTIONS requests
|
||||
if (\$request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
|
||||
# Proxy to backend server
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:$upstream_port;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
|
@ -184,6 +215,9 @@ EOF
|
|||
# Main web application
|
||||
generate_nginx_config "mnemo-cards.online" "" "webapp"
|
||||
|
||||
# API Backend Server
|
||||
generate_nginx_config "api.mnemo-cards.online" "8081" "api"
|
||||
|
||||
# VSCode Server
|
||||
generate_nginx_config "vscode.mnemo-cards.online" "8443" "vscode"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Nginx configuration for code.mnemo-cards.online
|
||||
# Generated by generate-nginx-configs.sh on Thu Nov 27 17:36:01 MSK 2025
|
||||
# Generated by generate-nginx-configs.sh on Thu Nov 27 22:04:55 MSK 2025
|
||||
# Service: forgejo
|
||||
|
||||
server {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Nginx configuration for mnemo-cards.online
|
||||
# Generated by generate-nginx-configs.sh on Thu Nov 27 17:36:01 MSK 2025
|
||||
# Generated by generate-nginx-configs.sh on Thu Nov 27 22:04:55 MSK 2025
|
||||
# Service: webapp
|
||||
|
||||
server {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Nginx configuration for vscode.mnemo-cards.online
|
||||
# Generated by generate-nginx-configs.sh on Thu Nov 27 17:36:01 MSK 2025
|
||||
# Generated by generate-nginx-configs.sh on Thu Nov 27 22:04:55 MSK 2025
|
||||
# Service: vscode
|
||||
|
||||
server {
|
||||
|
|
|
|||
Loading…
Reference in a new issue