title: 403 response with HttpClient but not with browser
body: <p>I’m having a problem with the HttpClient library in java.  </p>
  
  <p>The target web site is on SSL (<a href="https://www.betcris.com" rel="noreferrer">https://www.betcris.com</a>), and I can load the index page from that site just fine .</p>
  
  <p>However, the different pages showing odds for the different sports returns a 403 response code with HttpClient, but loading the same pages in a browser works just fine.  </p>
  
  <p>Here is such a page : <a href="https://www.betcris.com/en/live-lines/soccer" rel="noreferrer">https://www.betcris.com/en/live-lines/soccer</a>.</p>
  
  <p>I started troubleshooting this page with the information gathered by HttpFox (a Firefox add-on that resembles LiveHttpHeaders), making sure I had all the correct request headers and cookies, but I couldn’t get it to load using HttpClient.  I also determined that cookies have nothing to do with the problem, as I can remove all cookies for that web site within my browser, and then hit the page directly and it will load.</p>
  
  <p>I confirmed that there’s something special going on with these pages by using the online tool at <a href="http://www.therightapi.com/test" rel="noreferrer">http://www.therightapi.com/test</a>.  This tool allows you to input the url of a page along with any Request header you want, and shows you the response you get from the target web site.  Using that tool, I can load <a href="https://www.google.com" rel="noreferrer">https://www.google.com</a> just fine, but I get the same 403 error when trying to load <a href="https://www.betcris.com/en/live-lines/soccer" rel="noreferrer">https://www.betcris.com/en/live-lines/soccer</a>.</p>
  
  <p>Here's my setup at therightapi :</p>
  
  <p><a href="https://i.stack.imgur.com/9rAeB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9rAeB.png" alt="enter image description here"></a></p>
  
  <p>And the response :</p>
  
  <p><a href="https://i.stack.imgur.com/M00Tk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/M00Tk.png" alt="enter image description here"></a></p>
  
  <p>Does anyone know what’s going on here ?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT : I've created a test project, here's the java code, followed by the maven dependency you should have in your pom :</p>
  
  <pre><code>package com.yourpackage;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  
  import org.apache.http.HttpResponse;
  import org.apache.http.client.ClientProtocolException;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.impl.client.HttpClientBuilder;
  
  public class TestHttpClient {
      public static void main(String[] args) {
          String url = "https://www.betcris.com/en/live-lines/soccer";
  
          HttpClient client = HttpClientBuilder.create().build();
          HttpGet request = new HttpGet(url);
  
          // add request header
          request.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0");
          try {
              HttpResponse response = client.execute(request);
              System.out.println("Response Code : "
                      + response.getStatusLine().getStatusCode());
  
              BufferedReader rd = new BufferedReader(
                      new InputStreamReader(response.getEntity().getContent()));
  
              StringBuffer result = new StringBuffer();
              String line = "";
              while ((line = rd.readLine()) != null) {
                  result.append(line);
              }
          } catch (ClientProtocolException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
  }
  
  
  
      &lt;!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
      &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
      &lt;version&gt;4.5.3&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>