0

I am experiencing intermittent issues when using the Pingdom monitoring tool to check the status of my website.

Every 10-15 minutes I get an alert to say that a 302 has been found. What I can't understand is - i'm not doing any 302 temporary redirects. I am, however, doing 301 redirects (in certain circumstances).

Could this be a false positive from Pingdom?

Also, I have a redirect in code that does this. Would not specifying the HTTP response code cause an issue here?

header('Location: http://www.ayrshireminis.com');
exit();

The Pingdom data:

Request 1
GET / HTTP/1.0
User-Agent: Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)
Host: www.ayrshireminis.com

Received header
302 Found
Date: Tue, 24 Jul 2012 13:13:25 GMT
Server: Apache
Set-Cookie: prev_session_id=2a7001f5caa79bd36995953bf4853675; expires=Thu, 23-Aug-2012 13:13:25 GMT; path=/; domain=ayrshireminis.com
Location: http://www.ayrshireminis.com/
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=ISO-8859-1
crmpicco
  • 16,605
  • 26
  • 134
  • 210

1 Answers1

2

Looks to me like a cookie is being set on the response, then redirecting you to the same page. Because Pingdom uses a number of different monitoring sources, that cookie redirect behavior will cause a lot of problems. Then again, you may need it for actual website visitors.

Rather than monitor the root of the webpage, I would recommend creating a separate /status page just for Pingdom that:

  1. Doesn't set or use cookies
  2. Performs a cheap end-to-end health check of the application and backing services
  3. Returns a 200 response code only if everything checks out OK
gabrtv
  • 3,558
  • 2
  • 23
  • 28
  • I like the idea of the "status" page that you have suggested. The only problem is that I would need to mimic actual functionality, as close as possible to the homepage, on the "status" page. I would imagine that a homepage is used for Pingdom testing as it is the best test available, as obviously it is the first page a user hits. I'm also interested by your comment on being redirected to the _same_ page - would this be an issue? Does this constitute a 302 redirect? – crmpicco Jul 24 '12 at 15:29
  • The 302 redirect you are seeing is due to a cookie being set by your PHP framework (see the Set-Cookie header). The Location header shows you are being sent to the same page that you originally requested -- now with a cookie. Because the next request has this cookie, you should receive a normal 200 response code. For Pingdom to work properly, you need to prevent this auto cookie generation/redirect. It's probably a setting in your PHP framework. I would recommend testing it with a /status page just because you may _want_ the cookie behavior for most visitors. – gabrtv Jul 24 '12 at 18:15