-
Notifications
You must be signed in to change notification settings - Fork 202
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
(#134) Added nginx-based auto-language negotiation for /. #135
base: master
Are you sure you want to change the base?
(#134) Added nginx-based auto-language negotiation for /. #135
Conversation
**The Problem:** Upon following the directions to the letter, when I go to http://localhost:8080/ I get a 403: Forbidden nginx error screen. **The Reason:** No language detection / negotiation is done, and / is empty. **The Solution:** I added nginx-based language negotiation using the browser's `Accept-Language` header. If the user does not set a header (some search engines, curl, etc.), it will show the English page. This only applies to the / route. It is assumed that any other route will be in the desired language. Fixes Minds#134.
default en; | ||
~es es; | ||
~fr fr; | ||
~en en; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend adding at least one other language to the dev environment so proper testing can be done. Quizás español?
map $http_accept_language $lang { | ||
default en; | ||
~es es; | ||
~fr fr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list will need to be kept in sync with the languages supported by the application. There are methods to automatically sync this, particularly if you run Docker on production.
Was the index.php returning the error or where the assets? |
in general I think a step in the build scripts (like |
b3d79c1
to
26b051e
Compare
The Problem: Upon following the directions to the letter, when I
go to http://localhost:8080/ I get a 403: Forbidden nginx error screen.
The Reason: No language detection / negotiation is done, and / is empty.
The Solution: I added nginx-based language negotiation using the browser's
Accept-Language
header. If the user does not set a header (some search engines,curl, etc.), it will show the English page.
This only applies to the / route. It is assumed that any other route will be in
the desired language.
Now, http://localhost:8080/ will redirect to http://localhost:8080/en/.
IMPORTANT: You must manually remove your
minds_nginx
image and rebuild it.Fixes #134.