From f8a027fe139a69b5618703e65e0c4ee2cd66d0c9 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Thu, 14 Jun 2012 14:29:37 +0300 Subject: [PATCH] route requests with verifier hostname directly to verifier --- bin/router | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/router b/bin/router index 671cfb39f..56db15569 100755 --- a/bin/router +++ b/bin/router @@ -87,8 +87,18 @@ if (config.get('scheme') == 'https') { // redirect requests to the "verifier" processes if (config.get('verifier_url')) { var verifier_url = urlparse(config.get('verifier_url')).validate().normalize(); + + // support requests coming into the verifier hostname as well as those with /verify in the path, + // iff the verifier is configured explicitly with a distinct hostname + var verifier_host; + if (config.get('public_verifier_url') !== config.get('public_url')) { + verifier_host = urlparse(config.get('public_verifier_url')).validate().host; + } + app.use(function(req, res, next) { - if (/^\/verify$/.test(req.url)) { + if (/^\/verify$/.test(req.url) || + (req.headers.host && verifier_host && req.headers.host === verifier_host)) + { forward( verifier_url, req, res, function(err) { -- GitLab