Score:0

nginx returning 405 method not allowed for node apis with localized angular folders

uz flag

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;

   }
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.