Skip to content

Commit

Permalink
update location and try_files directive
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomas-orcid committed Jan 22, 2024
1 parent 8337c83 commit 0fc1b99
Showing 1 changed file with 26 additions and 33 deletions.
59 changes: 26 additions & 33 deletions ui/container-files/etc/nginx/conf.d/default.conf
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;
}

}
}

}

0 comments on commit 0fc1b99

Please sign in to comment.