Nginx proxy_next_upstream non_idemponent

栏目: 服务器 · Nginx · 发布时间: 7年前

内容简介:在 Nginx 做反向代理的时候,我们一般会配置这里有一个地方需要注意,

在 Nginx 做反向代理的时候,我们一般会配置 proxy_next_upstream ,如果某个 upstream 超时或出错,自动切换到下一个 upstram。

upstream backend{
  server 192.168.0.1;
  server 192.168.0.2;
}
location /example/ {
   proxy_pass http://backend;

   proxy_next_upstream error timeout http_500 non_idemponent;
}

这里有一个地方需要注意, non_idemponent ,Nginx 默认对 non-idempotent 请求,比如 POST /LOCK/PATCH,是不进行重试。常见的情况就是 POST 请求出错后不会重试,需要加上该设置。

normally, requests with a non-idempotent method (POST, LOCK, PATCH) are not passed to the next server if a request has been sent to an upstream server (1.9.13); enabling this option explicitly allows retrying such requests;

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

ppk on JavaScript, 1/e

ppk on JavaScript, 1/e

Peter-Paul Koch / New Riders Press / 2006-09-20 / USD 44.99

Whether you're an old-school scripter who needs to modernize your JavaScripting skills or a standards-aware Web developer who needs best practices and code examples, you'll welcome this guide from a J......一起来看看 《ppk on JavaScript, 1/e》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试