Skip to content

Commit

Permalink
CDPT-2264 Improve nginx's file serving.
Browse files Browse the repository at this point in the history
Previously a missing file caused an error. Now it's a 404 without an error.
  • Loading branch information
EarthlingDavey committed Nov 20, 2024
1 parent 85022da commit 51610aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions deploy/config/local/nginx/server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ server {

# Empty location blocks to allow access when "/" location
# sends an HTTP 503 during maintenance mode
location /app/themes/clarity/error-pages/ { }
location /app/themes/clarity/dist/ { }
location /app/themes/clarity/error-pages/ {
# If the file exists, serve it directly, else return 404.
try_files $uri =404;
}
location /app/themes/clarity/dist/ {
# If the file exists, serve it directly, else return 404.
try_files $uri =404;
}

# Rewrite old upload URLs to the bedrock equivalent
location /wp-content/uploads/ {
Expand Down
10 changes: 8 additions & 2 deletions deploy/config/server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ server {

# Empty location blocks to allow access when "/" location
# sends an HTTP 503 during maintenance mode
location /app/themes/clarity/error-pages/ { }
location /app/themes/clarity/dist/ { }
location /app/themes/clarity/error-pages/ {
# If the file exists, serve it directly, else return 404.
try_files $uri =404;
}
location /app/themes/clarity/dist/ {
# If the file exists, serve it directly, else return 404.
try_files $uri =404;
}

# Rewrite old upload URLs to the bedrock equivalent
location /wp-content/uploads/ {
Expand Down

0 comments on commit 51610aa

Please sign in to comment.