nginx把POST转GET请求解决405问题

405重定向,然后把POST转GET

upstream local {
    server 10.0.1.11:81;
}

server {
    listen 81;
    server_name testf.xxx.com;

    location / {
        root /data/f/ROOT/;
        index index.html index.htm;
    # 解决vue history模式,刷新404问题。
	try_files $uri $uri/ /index.html;
    }

    error_page 405 =200 @405;
    location @405 {
        root /data/f/ROOT/;
        proxy_method GET;
        proxy_pass http://local/$request_uri;
    }

    location /cashloan/ {
       proxy_pass https://testapicashloan.xxx.com;

    }

    location /front/ {
       proxy_pass https://testapifront.xxx.com;
    }

    access_log  /app/logs/f_access.log  main;
}

server {
    listen 80;
    server_name testf.xxx.com;
    location / {
      rewrite ^(.*) https://$server_name$1 permanent;
    }

}
原文地址:https://www.cnblogs.com/Csir/p/8025759.html