Question

Photo of Kiefer Slaton

0

Issue with Watchguard interrupting wp_remote_get

Hi all, 

I'm working on a Wordpress integration and need to be able to query the API. Below is my code block, with sensitive information starred out - 

function fetch_events_from_rock(){
	$auth = wp_remote_post('http://rock.*********.com/api/Auth/Login', array(
		'headers' => array(
			'authorization-token' => '**************'
		),
		'body' => array(
		'Username' => '*************',
		'Password' => '*************'
		)
	));
	$cookie = $auth['cookies'][0]->value;
	$headers = array(
		'authorization-token' => '***************', 
		'.ROCK' => $cookie, 
		'content-type' => 'application/json'
	);
	$events = wp_remote_get('http://rock.********.com/api/EventItems', array(
		'headers' => $headers
		));
	echo($events);
}

The $auth call is working perfectly fine and is returning the .ROCK cookie, which I am then passing into the headers for the $events call. However, the $events call returns a 403 forbidden error with the following body - 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Response denied by WatchGuard HTTP Proxy</title>
    <style type="text/css">
      body {
        font-family: Arial, Helvetica, Verdana, Sans-Serif;
        font-size: small;
        font-weight: normal;
        color: #000000;
      }
      div {
        margin-left: auto;
        margin-right: auto;
        text-align: center;
      }
      .box {
        width: 600px;
        background-color: #F2F2F2;
        border-left: solid 1px #C2C2C2;
        border-right: solid 1px #C2C2C2;
        vertical-align: middle;
        padding: 20px 10px 20px 10px;
      }
      p {
        text-align: left;
      }
      .red {
        font-weight: bold;
        color: Red;
        text-align: center;
      }
      .band {
        height: 20px;
        color: White;
        background: #333333;
        width: 600px;
        border-left: solid 1px #333333;
        border-right: solid 1px #333333;
        padding: 3px 10px 0px 10px;
      }
      div#wrap {
        margin-top: 50px;
      }
    </style>
  </head>
  <body>
    <div id="wrap">
      <div class="band"></div>
      <div class="box" style="word-wrap:break-word;">
        <p class="red">Response denied by WatchGuard HTTP Proxy.</p>
        <p><b> Reason: </b> all proposed authentication schemes denied </p>
        <p>Please contact your administrator for assistance.</p>
        <p>More Details:</p>
        <p><b>Method:</b> GET</p>
        <p><b>Host:</b> rock.*********.org</p>
        <p><b>Path:</b> /api/EventItems</p>
      </div>
      <div class="band">WatchGuard Technologies, Inc.</div>
    </div>
</body>
</html>

Can anyone give me some insight as to why the first request is working fine, but not the second, and how I can get around this WatchGuard HTTP Proxy? 

  • Photo of Kiefer Slaton

    0

    Right after I posted this, I figured it out. The .ROCK cookie needs to be set in a 'cookies' array, not in the 'headers' array. I'll leave this up in case it helps anyone else.