Skip to content

Instantly share code, notes, and snippets.

@jrgm
Created March 19, 2013 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrgm/5200281 to your computer and use it in GitHub Desktop.
Save jrgm/5200281 to your computer and use it in GitHub Desktop.
force redirect to return full https url on redirect in production.
diff --git a/server/lib/passport_yahoo.js b/server/lib/passport_yahoo.js
index 2b4d7fb..9cac18c 100644
--- a/server/lib/passport_yahoo.js
+++ b/server/lib/passport_yahoo.js
@@ -71,7 +71,15 @@ exports.views = function(app) {
session.clearBidUrl(req);
session.setCurrentUser(req, email);
- res.redirect(redirect_url);
+ if (config.get('env') === 'production') {
+ // In production, we run as 'http:'. But when we return this
+ // redirect to the client, we must declare it as 'https:'.
+ var full_url = util.format("https://%s%s",
+ config.get('issuer'), redirect_url);
+ res.redirect(full_url);
+ } else {
+ res.redirect(redirect_url);
+ }
statsd.timing(metric, new Date() - start);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment