Bit.ly URL Caching Issue - url-shortener

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

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.

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

Related

Error in Response body in the redirection URL in Jmeter

I am trying to do a performance testing for a project where the main URL performs a redirection and the redirection URL returns the token needed to proceed further.
I recorded the script with Jmeter and i can see that the main URL does the redirection with status code as "302" as expected and has the "Location" header in the response body.
But when the redirection URL is hit after the main URL as the sub sample, it returns "307 temporary redirection" in response header and an error message in the response body as "java.lang.IllegalArgumentException: Missing location header in redirect for GET "
I checked the same scenario in Neoload and i could notice that request sent in Neoload for rediection URL is same as the one sent in JMeter, the response header also matches. But Neoload was able to display the response body with the expected token. In Jmeter, it returned the error message.
Can someone clarify why the response body is not displayed in Jmeter if the same request can work in Neoload. I made sure there is no difference in the request header/body sent for the main URL.
I am pretty sure the issue is related to Jmeter but not sure how to get the proper response body.
Maybe there is more than one redirect and JMeter doesn't follow it.
You can play with Redirect automatically and/or Follow redirects boxes in HTTP Request sampler
also you can use a third-party sniffer tool like Wireshark or Fiddler to inspect which requests are actually being sent, pay attention to literally everything: URL, headers, body, etc.
It should also be possible to disable handling redirects in JMeter completely and extracting the redirect target from the Location header using Regular Expression Extractor or Boundary Extractor and manually add the next request giving the extracted URL in the "Path" field of the HTTP Request sampler

GCM URL and 302 redirect response

My Question is regarding GCM URL and 302 redirect response.
When I do curl -v url = https://gcm-http.googleapis.com/gcm/send, I get a 302 response with a new URL populated in location header. My question is, why can't I use the new URL received in 302 redirect always? What is the reason for Google responding with 302 redirect? I would really appreciate detailed explanation.
Many Thanks,
Sushil
Based from this article, error 302 means "Resource temporarily located elsewhere according to the Location header." This seems to be a previously reported issue (with GCM):
https://groups.google.com/forum/#!topic/android-gcm/WwEg6buc-K0
IO Exception while accessing Google Cloud message?
Suggested action is to re-run the request to the provided (temporary, alternate) URL.

URL Redirection in import.io

Hi I am working on URL http://www.goodtoknow.co.uk/recipes/healthy?page=1&cost_range=any&total_time=any&skill_level=any&tags%5B0%5D=Healthy&tags%5B1%5D=Healthy and creating extractor. But the URL gets redirected to the URL http://www.goodtoknow.co.uk/recipes/healthy automatically in import.io I want to create extractor for the first mentioned URL. Is it possible? Is it happening because of the page requires cookies which they does not support?
If you examine the network requests using chrome or any other web-debugger you can see that the website is calling a second URL for the recipie data:
http://www.goodtoknow.co.uk/recipes/search?q=&page=1&cost_range=any&total_time=any&skill_level=any&tags[0]=Healthy&tags[1]=Healthy&_=1458727079183
This url does not redirect without cookies and you can set the page number manually.
Try training using this URL and see if it avoids the redirecting.

How to add HTTP header to URL

I'm working with an API which provides a HTTP header called token with value 12abc3 and my url is https://example.com/view/quote. Is there a way by which I can add the header as a parameter in the url so that I can type it directly on my browser's address bar instead of using cURL orHurl.it??
The only way I can imagine being able to do this would be to write a small HTTP proxy that takes a specially formatted URL and extracts header values out of the URL and re-issues the request for you. I'm not aware of any service to do this automatically for you.
I think it's too late to reply but for those who still finding the solution
you can send your token through url like this
https://yoururl?Authorization=Bearer yourtokenhere

apache2 module custom http header

I'm try to redirect a illegal access and bring user to a log-in page, if user get permission and continue to access original, I need to keeping original request url. I try to write original url into http header zone, but I cannot retrieve this data from client.
Did apache2 or other module ignore custom http heaer? or I just miss something?
(BTW: I dont like use querystring, think about maybe next page still come as a redirection)
code example:
ap_set_content_type(r, "text/html");
apr_table_add(r->headers_out, "Location", conf->authurl);
apr_table_add(r->headers_out, "RequestUrl", url);
return HTTP_MOVED_TEMPORARILY;
// following code will be work fine.
apr_table_add(r->err_headers_out, "RequestUrl", url);
see as:
https://source.jasig.org/cas-clients/mod_auth_cas/tags/mod_auth_cas-1.0.9.1/src/mod_auth_cas.c