nginx cache expire settings issue.Can anyone help?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

nginx cache expire settings issue.Can anyone help?

vedranf
Hi I am new to Nginx. I need to add expire -1 for my JSON files in the below
urls

https://siteaddress/foldername /default.htm#/dashboard/ui.json


location /foldername {
           index  default.html default.htm;
       proxy_pass         http://siteaddress_eapp_entry;
    }


I have tried below syntax but still JSON files are caching

location  \foldername \.(json)$ {
                    expires -1;
           }  

Please help anyone to solve my issue,Thanks in advance.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255425,255425#msg-255425

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: nginx cache expire settings issue.Can anyone help?

Gregory Edigarov
you do not caching anything with proxy_pass alone.
you should use proxy_cache in conjunction.

On 12/11/2014 01:32 PM, anoopov wrote:

> Hi I am new to Nginx. I need to add expire -1 for my JSON files in the below
> urls
>
> https://siteaddress/foldername /default.htm#/dashboard/ui.json
>
>
> location /foldername {
>   index  default.html default.htm;
>         proxy_pass         http://siteaddress_eapp_entry;
>      }
>
>
> I have tried below syntax but still JSON files are caching
>
> location  \foldername \.(json)$ {
>                      expires -1;
>             }
>
> Please help anyone to solve my issue,Thanks in advance.
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255425,255425#msg-255425
>
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: nginx cache expire settings issue.Can anyone help?

Maxim Dounin
In reply to this post by vedranf
Hello!

On Thu, Dec 11, 2014 at 06:32:52AM -0500, anoopov wrote:

> Hi I am new to Nginx. I need to add expire -1 for my JSON files in the below
> urls
>
> https://siteaddress/foldername /default.htm#/dashboard/ui.json
>
>
> location /foldername {
>   index  default.html default.htm;
>        proxy_pass         http://siteaddress_eapp_entry;
>     }

In the URL provided "#/dashboard/ui.json" is a fragment, and will
not be sent to the server.

> I have tried below syntax but still JSON files are caching
>
> location  \foldername \.(json)$ {
>                     expires -1;
>            }  

This is syntactically incorrect and will cause syntax error due to
space in it.

If the "#" above is just a typo, then you can use something like
this to disable caching of *.json files within "/foldername":

    location /foldername {
        proxy_pass ...

        location ~ \.json$ {
            expires epoch;
            proxy_pass ...
        }
    }

Note that:

- the "~" is important as it marks regex location, see
  http://nginx.org/r/location for details;

- proxy_pass have to be repeated in the nested location.

More about locations can be found in the documentation, see
http://nginx.org/r/location.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx