UI not updating when using tomcat with apache & mod_jk

856 Views Asked by At

Well I have a weired issue, I was trying fronting tomcat with apache mod_jk using worker.

If I update my form with something like http://server.internal:8080 i.e tomcat then it works fine i.e updates are shown on screen and onrefresh the updates retain.

But if I update form with apache i.e http://server.internal/ then updates are seen in database but on refresh UI shows old values only, after refreshing 5-10 times then UI shows new values.

Also during refresh sometimes it shows old values while sometimes new values in the form.

I am using tomcat 7 + apache 2.2 + mod_jk on windows server.

I have disabled caching modules but still getting error.

Not sure where and how to debug such an issue.

Edited ---------

Request headers with apache

Cache-Control   no-cache,no-store,private,pre-check=0,post-check=0,max-age=0
Connection  close
Content-Encoding    gzip
Content-Length  10174
Content-Type    text/html;charset=utf-8
Date    Thu, 11 Dec 2014 19:39:36 GMT
Expires -1
Pragma  no-cache
Server  Apache/2.2.25 (Win32) mod_jk/1.2.40
Vary    Accept-Encoding

Request headers with tomcat

Content-Type    text/html;charset=utf-8
Date    Thu, 11 Dec 2014 19:43:43 GMT
Server  Apache-Coyote/1.1
Transfer-Encoding   chunked

Response Header with apache

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cache-Control   max-age=0
Connection  keep-alive
Cookie  JSESSIONID=7D3ACA49B478E8B3A126B37252B62481
Host    server
User-Agent  Mozilla/5.0 (Windows NT 6.0; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0

Response header with tomcat

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection  keep-alive
Cookie  JSESSIONID=7D3ACA49B478E8B3A126B37252B62481
Host    server:8080
User-Agent  Mozilla/5.0 (Windows NT 6.0; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0

Does not look a caching issue, tried with KeepAlive off also

2

There are 2 best solutions below

0
On

I think its problem with the browser local history, delete the history in your browser and try again.mostly it will works fine.

2
On

This definitely smells like a caching issue. To be sure, explicitly purge your browser's cache (or disable it) and see if that helps. If it does, you may want to add this in your apache's httpd.conf (replace the pattern */yourform.jsp by something that matches your form page(s)) in order to mark these pages as "uncacheable":

<Proxy */yourform.jsp>
    Header unset Pragma
    Header Always set Cache-Control: "no-cache,no-store,private,pre-check=0,post-check=0,max-age=0"
    Header Always set Pragma: "no-cache"
    Header Always set Expires "-1"
</Proxy>