For paths with an extension, give 404 if missing (#17035)

This commit is contained in:
Shrikant Sharat Kandula 2022-09-26 09:41:38 +05:30 committed by GitHub
parent 4456687400
commit 24655f6ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -28,7 +28,8 @@ server {
server_tokens off;
root /opt/appsmith/editor;
index index.html index.htm;
index index.html;
error_page 404 /;
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors
add_header Content-Security-Policy "frame-ancestors ${APPSMITH_ALLOWED_FRAME_ANCESTORS-'self' *}";
@ -66,6 +67,11 @@ server {
try_files \$uri /index.html =404;
}
# If the path has an extension at the end, then respond with 404 status if the file not found.
location ~ \.[a-z]+$ {
try_files \$uri =404;
}
location /api {
proxy_pass http://localhost:8080;
}

View File

@ -73,7 +73,8 @@ server {
server_tokens off;
root /opt/appsmith/editor;
index index.html index.htm;
index index.html;
error_page 404 /;
location /.well-known/acme-challenge/ {
root /appsmith-stacks/data/certificate/certbot;
@ -83,6 +84,11 @@ server {
try_files \$uri /index.html =404;
}
# If the path has an extension at the end, then respond with 404 status if the file not found.
location ~ \.[a-z]+$ {
try_files \$uri =404;
}
location /api {
proxy_pass http://localhost:8080;
}