Skip to content

Commit

Permalink
Merge pull request #2113 from 0xPolygon/hosted/DEVOPS-3370-nginx-fix-…
Browse files Browse the repository at this point in the history
…for-invalid-url

Deployment fix for invalid url to return 404
  • Loading branch information
sshrihar authored Oct 14, 2024
2 parents f8dccb9 + 2c4c955 commit 3bbd8aa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.review
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ COPY app /app

WORKDIR /app
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion build_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def update_nginx_config(pr_numbers, parsed_env):
for pr_number in pr_numbers:
location_block = f"""location /{pr_number} {{
alias /app/{pr_number};
try_files $uri $uri/ /index.html;
try_files $uri $uri/ =404;
error_page 404 /404.html;
}}
"""
Expand Down
5 changes: 3 additions & 2 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ http {
listen 80;

#REPLACE_APPS

location / {
alias /app/#environment/;
root /app/#environment;
index index.html;
try_files $uri $uri/ /index.html;
try_files $uri $uri/ /404.html;
error_page 404 /404.html;
}
}
Expand Down

0 comments on commit 3bbd8aa

Please sign in to comment.