(#134) Added nginx-based auto-language negotiation for /.#135
Open
hopeseekr wants to merge 1 commit intoMinds:masterfrom
Open
(#134) Added nginx-based auto-language negotiation for /.#135hopeseekr wants to merge 1 commit intoMinds:masterfrom
hopeseekr wants to merge 1 commit intoMinds:masterfrom
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.
hopeseekr
commented
Nov 1, 2018
| default en; | ||
| ~es es; | ||
| ~fr fr; | ||
| ~en en; |
Author
There was a problem hiding this comment.
I recommend adding at least one other language to the dev environment so proper testing can be done. Quizás español?
hopeseekr
commented
Nov 1, 2018
| map $http_accept_language $lang { | ||
| default en; | ||
| ~es es; | ||
| ~fr fr; |
Author
There was a problem hiding this comment.
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.
Member
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-Languageheader. 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_nginximage and rebuild it.Fixes #134.