Improve nginx default response

This commit is contained in:
SrGooglo 2025-05-21 19:08:30 +00:00
parent 75174c34d0
commit dbdfc945ff

View File

@ -184,8 +184,13 @@ http {
${this.ssl.cert_file_name ? `ssl_certificate ${this.ssl.cert_file_name};` : ""} ${this.ssl.cert_file_name ? `ssl_certificate ${this.ssl.cert_file_name};` : ""}
${this.ssl.key_file_name ? `ssl_certificate_key ${this.ssl.key_file_name};` : ""} ${this.ssl.key_file_name ? `ssl_certificate_key ${this.ssl.key_file_name};` : ""}
# Default route
location / {
# Include service-specific configurations
include ${normalizedConfigDir}/services.conf;
# Default route for /
location = / {
add_header Content-Type application/json; add_header Content-Type application/json;
add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Headers' '*' always; add_header 'Access-Control-Allow-Headers' '*' always;
@ -194,8 +199,15 @@ http {
return 200 '${mainEndpointJSON}'; return 200 '${mainEndpointJSON}';
} }
# Include service-specific configurations # Catch-all for any other unmatched path
include ${normalizedConfigDir}/services.conf; location / {
add_header Content-Type application/json;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Headers' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET,HEAD,PUT,PATCH,POST,DELETE' always;
return 404 '{"error":"Not found"}';
}
} }
} }
` `