zoukankan      html  css  js  c++  java
  • nginx 重发机制导致的重复扣款问题

    问题:

         nginx 重发机制导制重复提交(客户还款,被扣俩笔款,前端调用一次,后端执行2次)

    proxy_next_upstream

    语法: proxy_next_upstream error | timeout | invalid_header | http_500 | http_502 | http_503 | http_504 |http_404 | off ...; 
    默认值: proxy_next_upstream error timeout; 上下文: http, server, location

    error # 和后端服务器建立连接时,或者向后端服务器发送请求时,或者从后端服务器接收响应头时,出现错误 
    timeout # 和后端服务器建立连接时,或者向后端服务器发送请求时,或者从后端服务器接收响应头时,出现超时 
    invalid_header # 后端服务器返回空响应或者非法响应头 
    http_500 # 后端服务器返回的响应状态码为500 
    http_502 # 后端服务器返回的响应状态码为502 
    http_503 # 后端服务器返回的响应状态码为503
    http_504 # 后端服务器返回的响应状态码为504 
    http_404 # 后端服务器返回的响应状态码为404 
    off # 停止将请求发送给下一台后端服务器

    运用场景
    1、proxy_next_upstream http_500 | http_502 | http_503 | http_504 |http_404;
    当其中一台返回错误码404,500...等错误时,可以分配到下一台服务器程序继续处理,提高平台访问成功率,多可运用于前台程序负载,设置proxy_next_upstream
    proxy_next_upstream http_500 | http_502 | http_503 | http_504 |http_404;
    
    
    2、proxy_next_upstream off
    因为proxy_next_upstream 默认值: proxy_next_upstream error timeout;
    场景:当访问A时,A返回error timeout时,访问会继续分配到下一台服务器处理,就等于一个请求分发到多台服务器,就可能出现多次处理的情况,
    如果涉及到充值,就有可能充值多次的情况,这种情况下就要把proxy_next_upstream关掉
    proxy_next_upstream off
  • 相关阅读:
    LeetCode 230. Kth Smallest Element in a BST
    LeetCode 114. Flatten Binary Tree to Linked List
    LeetCode 222. Count Complete Tree Nodes
    LeetCode 129. Sum Root to Leaf Numbers
    LeetCode 113. Path Sum II
    LeetCode 257. Binary Tree Paths
    Java Convert String & Int
    Java Annotations
    LeetCode 236. Lowest Common Ancestor of a Binary Tree
    LeetCode 235. Lowest Common Ancestor of a Binary Search Tree
  • 原文地址:https://www.cnblogs.com/heroljy/p/10255632.html
Copyright © 2011-2022 走看看