intercepting upstream error with nginx

后端 未结 1 1266
遥遥无期
遥遥无期 2021-01-25 18:28

My app runs with nginx and uwsgi (python). My aim is to drop a connection (as explained here) e.g. when the python app decides to do so.

Is there a nginx parameter to \"

相关标签:
1条回答
  • 2021-01-25 18:37

    It turns out the answer is simpler than I thought - use the uwsgi_intercept_errors directive.

    Firstly, from the upstream app (in my case python) return 444.

    Secondly, configure nginx as follows:

    location / {
        uwsgi_pass                myapp;
        include                   uwsgi_params;
        [...]
    
        uwsgi_intercept_errors  on;
        error_page 444 @drop;
    }
    
    location @drop {
        return 444;
    }
    
    0 讨论(0)
提交回复
热议问题