diff --git a/bin/browserid b/bin/browserid
index f495e14fdceaf77b2b1168cbe5a7574018215fbf..92c84f0791597edfa137977d417376d876163afe 100755
--- a/bin/browserid
+++ b/bin/browserid
@@ -71,14 +71,7 @@ if (!config.get('keysigner_url')) {
   process.exit(1);
 }
 
-function internal_redirector(new_url, suppress_noframes) {
-  return function(req, resp, next) {
-    if (suppress_noframes)
-      resp.removeHeader('x-frame-options');
-    req.url = new_url;
-    return next();
-  };
-}
+// NOTE: ordering is important in this file.  Pay attention
 
 function router(app) {
   app.set("views", path.join(__dirname, "..", "resources", "views"));
@@ -180,12 +173,6 @@ function router(app) {
   // register all the WSAPI handlers
   wsapi.setup(app);
 
-  // setup health check / heartbeat
-  heartbeat.setup(app, function(cb) {
-    // let's check stuff!  first the heartbeat of our keysigner
-    heartbeat.check(config.get('keysigner_url'), cb);
-  });
-
   // the public key
   app.get("/pk", function(req, res) {
     res.json(config.get('public_key').toSimpleObject());
@@ -212,6 +199,13 @@ function router(app) {
   });
 };
 
+// #1 - Setup health check / heartbeat middleware.
+// This is in front of logging on purpose.  see issue #537
+heartbeat.setup(app, function(cb) {
+  // let's check stuff!  first the heartbeat of our keysigner
+  heartbeat.check(config.get('keysigner_url'), cb);
+});
+
 // request to logger, dev formatted which omits personal data in the requests
 app.use(express.logger({
   format: config.get('express_log_format'),
@@ -334,14 +328,6 @@ app.use(function(req, resp, next) {
   return next();
 });
 
-// a tweak to get the content type of host-meta correct
-app.use(function(req, resp, next) {
-  if (req.url === '/.well-known/host-meta') {
-    resp.setHeader('content-type', 'text/xml');
-  }
-  next();
-});
-
 // Strict Transport Security
 app.use(function(req, resp, next) {
   if (overSSL) {
@@ -381,4 +367,4 @@ db.open(config.get('database'), function (error) {
   app.listen(bindTo.port, bindTo.host, function() {
     logger.info("running on http://" + app.address().address + ":" + app.address().port);
   });
-});
\ No newline at end of file
+});
diff --git a/lib/heartbeat.js b/lib/heartbeat.js
index faa697c013c543b9a61338f76a589feb2d9b4902..109d8cd560a54222f3c226bd3e7973c54b4987d8 100644
--- a/lib/heartbeat.js
+++ b/lib/heartbeat.js
@@ -1,18 +1,29 @@
-const urlparse = require('urlparse');
+const
+urlparse = require('urlparse'),
+logger = require('./logging.js').logger;
 
 // the path that heartbeats live at
 exports.path = '/__heartbeat__';
 
 // a helper function to set up a heartbeat check
 exports.setup = function(app, cb) {
-  app.get(exports.path, function(req, res) {
-    function ok(yeah) {
-      res.writeHead(yeah ? 200 : 500);
-      res.write(yeah ? 'ok' : 'not ok');
-      res.end();
+  app.use(function(req, res, next) {
+    if (req.method === 'GET' && req.path === exports.path) {
+      function ok(yeah) {
+        res.writeHead(yeah ? 200 : 500);
+        res.write(yeah ? 'ok' : 'not ok');
+        res.end();
+      }
+      try {
+        if (cb) cb(ok);
+        else ok(true);
+      } catch(e) {
+        logger.error("Exception caught in heartbeat handler: " + e.toString());
+        ok(false);
+      }
+    } else {
+      return next();
     }
-    if (cb) cb(ok);
-    else ok(true);
   });
 };
 
@@ -35,4 +46,4 @@ exports.check = function(url, cb) {
     logger.error("can't communicate with " + shortname + ".  fatal: " + e);
     cb(false);
   });
-};
\ No newline at end of file
+};
diff --git a/resources/static/.well-known/host-meta b/resources/static/.well-known/host-meta
deleted file mode 100644
index eab9ec759cdac622c273f7fad74d08e690596002..0000000000000000000000000000000000000000
--- a/resources/static/.well-known/host-meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' 
-     xmlns:hm='http://host-meta.net/xrd/1.0'>
-
-  <hm:Host xmlns='http://host-meta.net/xrd/1.0'>browserid.org</hm:Host>
-
-  <Link rel="https://browserid.org/vocab#publicKey" href="/pk"></Link>
-
-  <Link rel='lrdd' template='https://browserid.org/users/{uri}.xml'></Link>
-
-  <Link rel='other' value='something-different'></Link>
-</XRD>