Search code examples
nginxnginx-confignginx-location

nginx '= /' not matching '/'


I have the following server, and it's the only server on my conf

    server {
    listen 8080;
    server_name _;

    location / {
        set $dest http://api_backend;
        set $dest_host 127.0.0.1;
        add_header X-route '= /';

    }

}

The X-route header is just to check if it goes inside, I make a request to http://localhost:8080/ but it's not going inside, however if I remove the = and just leave location / then it does enter. Could anyone help me on why this is happening? I want to match exactly / and not every other route in existence here.


Solution

  • It seems I need to set = /index.html instead of just = /.