Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(nginx): improve try_files, fix rewrites, increase file cache #3233

Merged
merged 15 commits into from Mar 17, 2023

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Mar 17, 2023

This PR updates the cache_file cache to 100000, fixes rewrites by removing their / trailing slash, and remove unnecessary try_files from known failing conditions.

@targos
Copy link
Member

targos commented Mar 17, 2023

a9aaa5e is currently deployed

@targos
Copy link
Member

targos commented Mar 17, 2023

deployed e4cf44f

@targos
Copy link
Member

targos commented Mar 17, 2023

deployed f479bfd

open_file_cache_valid 120s;
open_file_cache_min_uses 2;
open_file_cache_errors off;

error_page 404 @localized_404;
set $lang en;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor nitpick, can this be moved down to be directly above the error_page directive, as they're related?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I rather keeping this at the top, as it could be used in other places, and I'm afraid if it's right after there it will override the one from @english_fallback

location @english_fallback {
# Store the original language of the request
# We'll use this for the 404 in the try_files in @localized_404
if ($uri ~* ^/(ar|be|ca|de|es|fa|fr|gl|id|it|ja|ka|ko|nl|pt-br|ro|ru|tr|uk|zh-cn|zh-tw)/) {
set $lang $1;
}

rewrite ^/(ar|be|ca|de|es|fa|fr|gl|id|it|ja|ka|ko|nl|pt-br|ro|ru|tr|uk|zh-cn|zh-tw)/(.*)$ /en/$2;
rewrite ^/(ar|be|ca|de|es|fa|fr|gl|id|it|ja|ka|ko|nl|pt-br|ro|ru|tr|uk|zh-cn|zh-tw)/(.*)$ /en/$2 last;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change actually needed now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is verbose, but kinda goes with the behaviour we want to follow. Not really needed, but I feel like it's better to be explicit.

@targos
Copy link
Member

targos commented Mar 17, 2023

2513fe6 is deployed on both servers (live and fallback).

@richardlau richardlau merged commit 39694e4 into nodejs:main Mar 17, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants