nginx. Test which location used to process request

后端 未结 3 1572
既然无缘
既然无缘 2020-12-28 14:56

I\'m wondering how do I know if a particular location[s] used to process request in nginx.

E.g.:

# 1
location / {}

# 2
location ~ /[\\w         


        
3条回答
  •  渐次进展
    2020-12-28 15:38

    A word of warning on this approach. I found it's a bad idea to use location as your debug header, since Location is a real header used by the HTTP response 301.

    So if (like me) in your testing you end up with this:

    HTTP/1.1 301 Moved Permanently
    ...
    Location: http://mydomain.com/banana/
    location: banana
    

    Then your browser will freak out and report Duplicate headers received from server. So use locationdebug or something safe.

提交回复
热议问题