Search code examples
url-shortenerbit.ly

Bit.ly URL Caching Issue


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!!


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.