Can someone explain the sequence of events when a request for non existent file: sites/default/files/styles/medium/public/french_toast.jpg
What I think happens is:
1.Matches 1st location and attempt to serve file, which fails and then is told to go to @rewrite location.
2.rewrite rule is matched and processing cycle restarts like a new request and location / is matched causing a proxy pass to be made to apache server and the file is served.
location ~ ^/sites/.*/files/styles/
{
try_files $uri @rewrite;
}
location @rewrite
{
rewrite ^/(.*)$ /index.php?q=$1;
}
location /
{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}