Disabling Expires headers

119 views
Skip to first unread message

Matt Raible

unread,
Nov 9, 2013, 6:39:50 PM11/9/13
to wr...@googlegroups.com
Is it possible to turn off wro4j setting expires headers. I'm using Apache to gzip and set expires headers on my JS and CSS. However, when I configure wro4j to concat/minify my assets, it overrides Apache's expires headers. It seems to be setting them the expiry date to 2000/1/1.

Thanks,

Matt

Alex Objelean

unread,
Nov 10, 2013, 6:10:31 AM11/10/13
to wr...@googlegroups.com
Hi Matt, 

The expected default behavior is to have expire headers to be set 1 year in the future. It is weird that your expiry date is set to year 2000 (would be curious to understand why). Nevertheless, in order to control the expire date headers, you have the following options:

1) Extend WroFilter and override the  WroFilter#setResponseHeaders(final HttpServletResponse response)  method.
2) Extend WroFilter and override the  WroFilter#newResponseHeadersConfigurer()  method. This method returns ResponseHeadersConfigurer object which 
3) Create another filter which is mapped to the same path as WroFilter and override the headers in doFilter method.
4) Add in wro.properties a new property with key header
Example: header=Expires: Thu, 15 Apr 2010 20:00:00 GMT | cache-control: public

Let me know if that helps or if you have other suggestions.

Thanks,
Alex

Matt Raible

unread,
Nov 10, 2013, 10:59:16 AM11/10/13
to wr...@googlegroups.com
I figured out what was causing this. I had the following in my wro.properties:

debug=true

Changing it to "false" gives me the behavior I want.

Thanks,

Matt

--
You received this message because you are subscribed to a topic in the Google Groups "wro4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wro4j/DIiyaUlO53U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wro4j+un...@googlegroups.com.
To post to this group, send email to wr...@googlegroups.com.
Visit this group at http://groups.google.com/group/wro4j.
For more options, visit https://groups.google.com/groups/opt_out.

Alex Objelean

unread,
Nov 10, 2013, 5:01:56 PM11/10/13
to wr...@googlegroups.com, ma...@raibledesigns.com
Indeed, the caching is disabled in development mode (debug=true), to prevent browser caching. 

Alex
Reply all
Reply to author
Forward
0 new messages