Question

This seems to be a serious issues with Bit.ly URL shortening service. Actually, I have created a bit.ly URL1 like "http://bit.ly/xyzabcd" to my URL2 "www.myserver.com/myjson.txt".

Case 1: Hitting the bitly URL1 I am getting the response whatever it is in myjson.txt. This is expected.

Case 2: If I update the URL2's json content and then hit back the bitly URL1 the browser is caching the response. This is BAD case.

Case 3: If I manually hit the URL2 then I get the old response, but after appending URL with some random no, it is getting new response as expected. This is manual.

My Real Use Case: I am using this bit.ly URL in my Chrome Extension App and it is failing to work on updated response because inside the bit.ly URL1 is caching old response itself.

Here the issue is we can't modify bit.ly URL1 and we can't let bit.ly to modify(append any randon no) my URL2 response.

I appreciate your help and advice to resolve this issue. I was assuming the bit.ly will always fetch the latest response, but it is FAILING in this Case 2!!

Was it helpful?

Solution

nrathaus is correct. Bitly doesn't control the data sent from your server. We send a 301 redirect, which your browser should cache, but there is no content in that response other than the location of the long URL.

You should make sure that "www.myzerver.com/myjson.txt" is sending the appropriate headers to tell your browser to never cache it. See this StackOverflow answer for details on which headers to send.

OTHER TIPS

This is the case of some other url-shorteners when you have the ability to change the destination url with the same short url it always redirects to the old destination url. That's because of the browser cache of the response 301 redirect to old destination. When you add some random argument to the shortened url, it will return the correct destination url. It is a problem of the browser caching the redirect. If you need to confirm, insert the shortened url in a private session (incognito windows) and it will act correctly!

https://bugs.chromium.org/p/chromium/issues/detail?id=633023&can=1&q=clear%20301%20redirects&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top