Welcome! Log In Create A New Profile

Advanced

Re: Need to add expires header conditionally based on mime types

June 18, 2013 10:24AM
Are they presented as .js, .css etc to the client browser?

If so, then this is sufficient.

Steve

On Fri, 2013-06-14 at 08:28 +0530, Silver Moon wrote:
> hi
>
>
> this is not sufficient.
>
>
> in my application for example, js, css and images are generated
> dynamically from php scripts. and there are multiple scripts to
> generate such content.
>
>
> therefore i need mime based expire headers.
>
> On Fri, Jun 14, 2013 at 12:23 AM, Simon Hönscheid
> <mailinglisten@simonhoenscheid.de> wrote:
> Hi Silver,
>
> this will fit your needs:
>
> location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
> expires 7d;
> }
>
> Simon
> Am 13.06.2013 14:26, schrieb Silver Moon:
> > Hi
> >
> > I need to add expires headers conditionally based on a
> certain mime type.
> > For example add expires 7d to text/css
> >
> > How to do this ?
> >
> > So far I found that $sent_http_content_type contains the
> mime type that
> > is send in http response. But its not possible to put it in
> a if
> > directive and do expires
> > either,
> >
> > if ($sent_http_content_type = "text/css")
> > {
> > expires 7d;
> > }
> >
> > will not work.
> >
> > Also tried to create a map and try to hack around, but could
> not do it.
> >
> > I cannot do on file based or specific directory location
> based because
> > lots of css/js content is generated from php files
> dynamically. And
> > there are multiple php files generating content.
> >
> > I need a neat way to implement this, is it possible ?
> >
> > --
> > Silver
> >
> >
>
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
>
>
> --
> Silver
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

--
Steve Holdoway BSc(Hons) MNZCS
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Re: Need to add expires header conditionally based on mime types

GreenGecko June 18, 2013 10:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 110
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready