You can send nginx variable values via headers. Handy for development.

add_header X-uri "$uri";

and you'll see in your browser's response headers:


I sometimes do this during local development.

It's also handy for telling you if a subsection is getting executed or not. Just sprinkle it inside your clauses to see if they're getting used.

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
    add_header X-debug-message "A static file was served" always;

location ~ .php$ {
    add_header X-debug-message "A php file was used" always;

So visiting a url like will trigger the latter header while visiting will trigger the former header.

  • 2
Reply Report

Related Questions

Trending Tags