nginx. Test which location used to process request

后端 未结 3 1455
既然无缘
既然无缘 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:25

    If you just want to see which block was used, and don't care about returning otherwise valid results, it might be more straight-forward to use return rather than add_header.

    location / {
        return 200 'location 1';
    }
    
    location ~ /(\w+\-)\.html {
        return 200 'location 2';    
    }
    
    location @named {
        return 200 'location named';
    }
    

提交回复
热议问题