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

(#134) Added nginx-based auto-language negotiation for /. #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hopeseekr
Copy link

@hopeseekr hopeseekr commented Nov 1, 2018

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.

**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;
Copy link
Author

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;
Copy link
Author

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.

@markharding
Copy link
Member

Was the index.php returning the error or where the assets?
I believe that Minds/engine@b7bf650 should resolve that issue

@DaGhostman
Copy link

in general I think a step in the build scripts (like ONBUILD in docker) could compile the list of languages and get it included in the main nginx configuration, that way the code generation will not have a chance to break the main config

@markharding markharding force-pushed the master branch 4 times, most recently from b3d79c1 to 26b051e Compare April 17, 2020 08:54
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

3 participants