I have this config
location /mirror/files {
valid_referers none server_names example.com *.example.com;
if ($invalid_referer) {
rewrite ^/(.*)$ http://example.com/;
}
index index.php;
}
If I visit a link http://example.com/mirror/files/test.zip with referer that start with "http://example2.com" I can access the file. How to make it work? UPDATE: I can see from the server logs the referer is sent so it's not empty.