Moving app to other server, avoid very sticky browser cache

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
joben
Posts: 230
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Moving app to other server, avoid very sticky browser cache

Post by joben »

Scenario:

App "Acme" exists on ServerA and is to be moved to ServerB.
The URL for Acme is https://acme.example.org
Tons of users go to this URL.

The Acme app along with its database is successfully imported to ServerB, and ServerA has had its host header for Acme in server.xml deactivated so that the Acme app becomes unaccessable. The DNS A record for acme.example.org has been changed to the ServerB IP address, and many hours have passed since the change so that all users on the internet should have the updated DNS information by now.

Yet, users who try to log in via https://acme.example.org are still ending up on ServerA where they will face a blank screen or an error (which is expected now that the App doesn't reside here anymore). Only after emptying the browser cache are they able to reach the Acme app that is now on ServerB.

Is there some way to prevent having to manually instruct the users to empty their browser cache? Perhaps Tomcat on ServerA could force users to go to ServerB?
Regards, Joakim

Image
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Moving app to other server, avoid very sticky browser cache

Post by hpl123 »

I am no expert on this and don´t have any concrete solutions and also the tips here are possibly not even applicable in your case but thought I´d share what I would look at. I know there are different scripts or snippets of code one can use on HTML and other web pages that instruct the browser to refresh or disable the cache etc. and something like that might trigger the browser to do a reload automatically which then maybe direct the user to the new server. The question is, at which "touchpoint" can/should you have that script/code and also related, where is the "hickup" i.e what part of you infrastructure is it that cause this because obviously that is where you should target your "fix".

Also read up on DNS flushing, that might be related or be something you can use? I can´t remember exactly what it does but think it is related to exactly these types of issues.

Another thing you could do is create some redirect somewhere or even in Tomcat on server A IF the user actually gets there (or are they stuck in some limbo in between server A and B possibly) or DNS trick in between so domain > another domain > server.

PS: If nothing else, try googling "dns propagation problems" where you have a lot of information about similar problems and I guess also solutions.
Henrik (V8 Developer Ed. - Windows)
joben
Posts: 230
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Re: Moving app to other server, avoid very sticky browser cache

Post by joben »

Thanks for the advice hpl123.

I am quite confident that the issue is within the browsers own cache. I usually clear the DNS cache at the DNS servers after making a change similar to this scenario. Besides, the TTL is set to a very low value to begin with. It takes a few minutes or hours for every device to "respect" the new change. The name resolution can be tested by going to a users machine and sending a ping to acme.example.org to confirm that the IP of ServerB responds. It is just the browser that seems to completely disregard the change, until you force empty the browser cache that is :(
Regards, Joakim

Image
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Moving app to other server, avoid very sticky browser cache

Post by PointsWell »

I’m not sure I understand the issue fully, but would using a reverse proxy not fix this? As all traffic would go to acme.example.org and the reverse proxy would direct them to the correct private server.
joben
Posts: 230
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Re: Moving app to other server, avoid very sticky browser cache

Post by joben »

PointsWell wrote: Thu Apr 25, 2024 5:57 pm I’m not sure I understand the issue fully, but would using a reverse proxy not fix this? As all traffic would go to acme.example.org and the reverse proxy would direct them to the correct private server.
I am unfamiliar with using reverse proxies, but this might actually be a good idea to avoid the problem from ever appearing again. Are there any cons of using a reverse proxy that I should be aware of?
Regards, Joakim

Image
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Moving app to other server, avoid very sticky browser cache

Post by hpl123 »

Yeah, good point about reverse proxy. I use it on Windows IIS to get SSL and some other minor webrelated things. Works great. We have discussed things related to reverse proxy before in the forum and also have some guides if I remember correctly so search the forum.
Henrik (V8 Developer Ed. - Windows)
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Moving app to other server, avoid very sticky browser cache

Post by PointsWell »

Here’s the link to the discussion on reverse proxies

https://awareim.com/forum/viewtopic.php?f=4&t=11981
joben
Posts: 230
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Re: Moving app to other server, avoid very sticky browser cache

Post by joben »

Thanks!
Regards, Joakim

Image
Post Reply