Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.
See all our reports

Discover hidden HTTP redirects with XRebel

Have you observed how your web application can slow down due to extra HTTP requests? The HTTP client may execute multiple requests instead of just one request and you might not even notice! HTTP redirects are the cause of the extra requests. Also, it is not easy to spot those extra requests if you’re not specifically looking for them to appear. XRebel, the lightweight Java profiler can give you the insight needed to find extra requests, if any.

From a Java application developer’s point of view, HTTP redirects are supposed to be straightforward – with no special handling required. But the underlying library is what handles the communication, including HTTP redirects. For example, here is a snippet that sends a search request to google.com.

public static void makeRequest() {
   try {
       URL url = new URL("https://www.google.com/?q=XRebel");
       URLConnection yc = url.openConnection();
       try (InputStream is = yc.getInputStream()) {
       // consume the stream           
       }
   } catch (Exception e) {
       // ...
   }
}

XRebel can easily visualize what happened during this request to give you a sense for what is going on under the hood. This is done by tracing the invocations inside the client library.

image01

Given you are not aware that HTTP redirects are involved, this might be costing you twice as much as it should be. XRebel can reveal such situations early, before your application goes live.

The initial request to google.com returned with the status code 302. The client then made another call to google.ee and this returned with status code 200. But how does the application know that it should connect to google.ee instead of google.com? Let’s take a closer look at the details:

image00

Here, XRebel reveals that the initial request has a “Location” attribute in the response headers. This attribute contains the correct URL for the next request. The library knows how to handle it, “if response code equals 302, obtain the value of the Location header attribute and try again”.

Locating HTTP redirects can be really helpful to you while you are developing an application. the redirects can be caused by the deprecated URLs used in the application. Getting insight into redirects can help you make an informed decision on whether the application can be improved by using new URLs. Also, HTTP redirects add an extra network round-trip, instead of relying on a single request, the application would have to execute 2 requests.

Want to start locating HTTP redirects in your application right away?

TRY XRebel for Free Now!