Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changes in HTML not reflected as long as I am using proxy

I shifted from Eclipse to Jdeveloper. I had a weird problem that I was able to solve but not able to understand.

Whenever I made any changes in HTML in Jdeveloper's web projects the changes were not reflected when I ran the HTML again. The old webpages kept coming in the webbrowser. Same source code. Same CSS/JS. I found that as long as there were proxy settings in my web browser the changes were not reflected. But if I switched off the proxy the changes made in HTML were reflected i.e webpage were displayed with the changes made from last time.

By proxy set I mean proxy setting placed at the following Window -> Start Menu -> internet options -> Connections -> LAN Settings -> Proxy Server

I have tried to run the resulting URL on Google chrome, Firefox and internet explorer. As long as the web browser was using proxy the changes made in HTML were not shown by running it again.

In Eclipse Juno I simply had to clean Tomcat's directory to get changes reflected.

Anyone can explain why this happens?

like image 206
Aseem Bansal Avatar asked Feb 11 '14 18:02

Aseem Bansal


2 Answers

Web servers return HTTP headers with every response, and usually those headers specify how long the response can be cached for. Proxy servers read those headers and make a decision whenever they see the same request again -- whether to propagate that request to the server again, or to simply return the cached copy of the response.

You can modify your server's configuration so that it the next time it tells the proxy server not to cache pages. However, some proxy servers are mis-configured or broken, and will cache pages that they are not supposed to cache.

For those cases, one ugly solution that works is to give your JS and CSS files new names whenever you change them. For example, if your index.html file includes index.css and index.js, and you make a change to index.js, you can save the changed file as index.2.js and change the tag in your index.html file to point to index.2.js from now on.

That's a bit drastic, but it works. A simpler solution to start with is to refresh your page using Shift-F5 rather than just F5 (in your browser). That tells the browser to force a refresh of all cached pages, whenever possible.

like image 180
Abednego Avatar answered Oct 21 '22 22:10

Abednego


This seems tied to your proxy server type. There are several proxy server types, one of which is a "Caching Proxy Server". Which, if many users are connected to it, allows static pages to be stored locally on the server for repetitive requests from the client(you). When you change the proxy it is most likely just sending you an updated copy due to not having you as an active client, or being that you are a new user.

I would assume that the content on the new software you are building is precaching saved page names where as Eclipse Juno is was generating real time screens on the fly, bypassing the cached server option.

like image 21
Rich Avatar answered Oct 21 '22 22:10

Rich