Random port appended in OmniAuth callback?
Created by: ghost
I am using node-http-proxy with the following code:
var railsProxy = new httpProxy.HttpProxy({
target: {
host: 'localhost',
port: CONFIG.RAILS_PORT,
}
});
var socketProxy = new httpProxy.HttpProxy({
target: {
host: 'localhost',
port: CONFIG.SOCKET_PORT,
}
});
var reverseProxy = http.createServer(function(req, res) {
switch(req.headers.host) {
case "socket.mysite.com":
socketProxy.proxyRequest(req, res);
break;
default:
railsProxy.proxyRequest(req, res);
break;
}
});
Currently, this is breaking my omniauth for facebook. When I click "login with facebook" on my site,
I am 404'ed with the following url in my url bar:
http://mysite.com:49592/users/auth/facebook/callback?code=AQBab4LR3HFBEs9Oo0yGqR-RbZHDTymeUJwmyl9Fg1MW9DBvwBIbH_vsECR5jcq_excWaCZGU-WiEUv8hPfZ_C9FT0xHZ28CMueDWAtb3_aZWduRjGMvuSDey_DPNi03O7K62S2mthQ6_qWP5GCGU-jZCaYg1Hrn1RXZxowuhCxz-yrlSxP27upshnsWwZWFY9I#_=_
Another attempt at this will produce port 49602. Which is extremely weird as I was testing my site on http://mysite.com. Where does the random port come from?
I have decided to test what is causing this, so I wget to see the url redirection:
$ wget http://mysite.com/users/auth/facebook
--2012-04-09 23:54:48-- http://mysite.com/users/auth/facebook
Resolving mysite.com... 127.0.0.1
Connecting to mysite.com|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://graph.facebook.com/oauth/authorize?response_type=code&client_id=258465037564047&redirect_uri=http%3A%2F%2Fmysite.com%3A49689%2Fusers%2Fauth%2Ffacebook%2Fcallback&scope=email%2Coffline_access [following]
--2012-04-09 23:54:48-- https://graph.facebook.com/oauth/authorize?response_type=code&client_id=258465037564047&redirect_uri=http%3A%2F%2Fmysite.com%3A49689%2Fusers%2Fauth%2Ffacebook%2Fcallback&scope=email%2Coffline_access
Resolving graph.facebook.com... 66.220.147.27
Connecting to graph.facebook.com|66.220.147.27|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://www.facebook.com/dialog/permissions.request?app_id=258465037564047&display=page&next=http%3A%2F%2Fmysite.com%3A49689%2Fusers%2Fauth%2Ffacebook%2Fcallback&response_type=code&perms=email%2Coffline_access&fbconnect=1 [following]
--2012-04-09 23:54:48-- https://www.facebook.com/dialog/permissions.request?app_id=258465037564047&display=page&next=http%3A%2F%2Fmysite.com%3A49689%2Fusers%2Fauth%2Ffacebook%2Fcallback&response_type=code&perms=email%2Coffline_access&fbconnect=1
Resolving www.facebook.com... 66.220.149.18
Connecting to www.facebook.com|66.220.149.18|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.facebook.com/common/browser.php [following]
--2012-04-09 23:54:48-- http://www.facebook.com/common/browser.php
Connecting to www.facebook.com|66.220.149.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13997 (14K) [text/html]
Saving to: `facebook'
100%[==========================================================================>] 13,997 --.-K/s in 0.04s
If I remove the port from the url, I am actually able to login. Anyone know why I am seeing this random port being inserted into my url?