-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1094 from ORCID/feature/nginx_ensure_locale_stays…
…_visible_in_uri_path Feature/nginx ensure locale stays visible in uri path
- Loading branch information
Showing
2 changed files
with
38 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,36 @@ | ||
map $cookie_locale $langCode { | ||
default en; | ||
~*^cs cs; | ||
~*^de de; | ||
~*^es es; | ||
~*^fr fr; | ||
~*^it it; | ||
~*^ja ja; | ||
~*^ko ko; | ||
~*^pt pt; | ||
~*^ru ru; | ||
~*^ui ui; | ||
~*^zh-CN zh-CN; | ||
~*^zh-TW zh-TW; | ||
default en; | ||
~*^cs cs; | ||
~*^de de; | ||
~*^es es; | ||
~*^fr fr; | ||
~*^it it; | ||
~*^ja ja; | ||
~*^ko ko; | ||
~*^pt pt; | ||
~*^ru ru; | ||
~*^ui ui; | ||
~*^zh-CN zh-CN; | ||
~*^zh-TW zh-TW; | ||
} | ||
|
||
server { | ||
listen 8090; | ||
server_name localhost; | ||
listen 8090; | ||
server_name localhost; | ||
|
||
#access_log /var/log/nginx/host.access.log main; | ||
# Uncomment logfile entries for debug of requests recieved by this virtual host. | ||
#access_log /var/log/nginx/host.access.log main; | ||
#error_log /var/log/nginx/host.access.log notice; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
location ~ ^/ui/(.*) { | ||
# Redirect requests for `/ui/(.*)` to the Angular application in the preferred language of the browser | ||
# For reference on multi language support see: https://angular.io/guide/i18n-common-deploy#configure-a-server | ||
rewrite ^/ui/(.*)$ /${langCode}/$1 break; | ||
|
||
# Configure a fallback route in the NGinX server to serve the index.html when requests arrive for `/ui/login` | ||
# Requires static html content to have a `base-href=./` entry | ||
try_files $uri $uri/ /${langCode}/index.html?$args; | ||
|
||
# Or use the following line instead | ||
# auto-index on; | ||
} | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
# Requires base href {in the index.html files} be set to "./" or "/ui/<langCode>/" e.g "/ui/it/" or "/ui/en/" ############################################################# | ||
location ~ ^/(cs|de|en|es|fr|it|ja|ko|pt|ru|zh-CN|zh-TW)/(.*) { | ||
try_files $uri $uri/ /$1/index.html?$args; | ||
} | ||
|
||
} | ||
} | ||
|
||
} |
This file contains 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