Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Fix host used in id site redirect callback #537

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/controllers/id-site-redirect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

var getHost = require('../helpers/get-host');

/**
* This controller registers a new user using Stormpath's hosted ID Site
* service. This will redirect the user to the ID site which allows a user to
Expand All @@ -14,7 +16,8 @@ module.exports = function (options) {
return function (req, res) {
var application = req.app.get('stormpathApplication');
var config = req.app.get('stormpathConfig');
var cbUri = req.protocol + '://' + req.get('host') + config.web.idSite.uri;
var cbUri = req.protocol + '://' + getHost(req) + config.web.idSite.uri;

var url = application.createIdSiteUrl({
callbackUri: cbUri,
logout: options.logout,
Expand All @@ -26,6 +29,7 @@ module.exports = function (options) {
'Location': url,
'Pragma': 'no-cache'
});

res.end();
};
};