I did changes in ngnix file to make it work for localized angular dist folder with multiple languages. client side application working properly with url routing etc but node apis for authentication are returning "405 method not allowed" error. any help would be appreciated. Solutions I have tried,
error_page 405 =200 $uri; -- it gives 200 in status code with empty response tried setting up orgin * but still it did not working Below is my nginx configuration
root /var/www/web/dist;
# Fallback to default language if no preference defined by browser
if ($accept_language ~ "^$") {
set $accept_language "da";
}
# Redirect "/" to Angular application in the preferred language of the browser
rewrite ^/$ /$accept_language permanent;
# Everything under the Angular application is always redirected to Angular in the
# correct language
location ~ ^/(da|en) {
try_files $uri /$1/index.html?$args;
}
location /nodeApi/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header content-type "application/json";
proxy_cache_bypass $http_upgrade;
proxy_pass http://localhost:4444/nodeApi;
}
0 Answers