Re: Modify Cache-Control header
2012/11/18 Terence M. Bandoian tere...@tmbsw.com: On 11/16/2012 2:38 PM, Jose María Zaragoza wrote: Hi: I'm using Tomcat 6 ( I don't remember the exact release, I hope to be forgiven by Pid ) I need to modify Cache-Control header in some responses ( forcing them to not be cached ) What is the best way to do it ? a) To implement a Valve ( check request context path and if it match ,to modify response header ) b) To implement a filter c) Others ( any property in Tomcat's configuration files that I don't know ) Thanks and regards Hi, Jose- If you have access to the JSP or Java, you might use something like this: response.setHeader( Expires, -1 ); response.setHeader( Cache-Control, no-cache ); See http://docs.oracle.com/javaee/6/api/index.html?javax/servlet/http/HttpServletResponse.html +1. UrlRewriteFilter can be used to set headers, if you do not want to write the code by yourself. http://wiki.apache.org/tomcat/AddOns ExpiresFilter is available in Tomcat 7 Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Modify Cache-Control header
On 11/16/2012 2:38 PM, Jose María Zaragoza wrote: Hi: I'm using Tomcat 6 ( I don't remember the exact release, I hope to be forgiven by Pid ) I need to modify Cache-Control header in some responses ( forcing them to not be cached ) What is the best way to do it ? a) To implement a Valve ( check request context path and if it match ,to modify response header ) b) To implement a filter c) Others ( any property in Tomcat's configuration files that I don't know ) Thanks and regards Hi, Jose- If you have access to the JSP or Java, you might use something like this: response.setHeader( Expires, -1 ); response.setHeader( Cache-Control, no-cache ); See http://docs.oracle.com/javaee/6/api/index.html?javax/servlet/http/HttpServletResponse.html -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Modify Cache-Control header
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jose, On 11/16/12 3:38 PM, Jose María Zaragoza wrote: I need to modify Cache-Control header in some responses ( forcing them to not be cached ) What is the best way to do it ? a) To implement a Valve ( check request context path and if it match ,to modify response header ) b) To implement a filter c) Others ( any property in Tomcat's configuration files that I don't know ) I would avoid writing a Valve unless you must: a Valve will tie you to Tomcat and possibly to a particular version of Tomcat in some cases. I don't believe Tomcat will mutate your Cache-Control headers so you are probably safe using a Filter. I can't really imagine another way to do this besides writing a Filter or Valve (without using a reverse-proxy as Igor suggests). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCoShMACgkQ9CaO5/Lv0PDQlwCgxGbXPVOU65ug+BlGtkHdrUkm UjMAn2wb+lcntQBcp0O4LL3sOWRLxPm8 =Ib7m -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Modify Cache-Control header
On 17/11/2012 7:38 AM, Jose María Zaragoza demablo...@gmail.com wrote: Hi: I'm using Tomcat 6 ( I don't remember the exact release, I hope to be forgiven by Pid ) I need to modify Cache-Control header in some responses ( forcing them to not be cached ) What is the best way to do it ? a) To implement a Valve ( check request context path and if it match ,to modify response header ) b) To implement a filter c) Others ( any property in Tomcat's configuration files that I don't know Or put apache infront and use mod_expiers Thanks and regards - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org