Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Requests being recorded #12

Open
jimmyeisenhauer opened this issue Nov 20, 2015 · 5 comments
Open

Duplicate Requests being recorded #12

jimmyeisenhauer opened this issue Nov 20, 2015 · 5 comments

Comments

@jimmyeisenhauer
Copy link

I have set up sepia with the below express and proxy server and I am getting two recordings 1 with http and 1 with https. The server is setup as http and proxies to https. Is this something I could fix on the sepia side? Or is this with how the proxy is handling the http requests?

Thanks!

var server = express();
server.set('port', 3000);

var apiProxy = httpProxy.createProxyServer();
var apiForwardingUrl = 'https://commerce-api.example.com';
console.log('Forwarding API requests to ' + apiForwardingUrl);

// commerce api
server.all("/commerce/*", function(req, res) {
apiProxy.web(req, res, {
target: apiForwardingUrl,
agent: https.globalAgent,
headers: {
host: 'commerce-api.example.com'
}
});
});

server.listen(server.get('port'), function() {
console.log(' server'.blue + ' started '.green.bold + 'on port '.blue + server.get('port'));

});

@avik-das
Copy link
Contributor

Hi @jameseisenhauer: Sorry for the delay, but unfortunately, without knowing the exact tools you're using (which proxy server?), I wouldn't be able to answer the question. Could you check if the proxy is actually making two outbound requests or just one?

@jimmyeisenhauer
Copy link
Author

I found out what was writing the request twice. It is this line in the cache file: ['http', 'https'].forEach(function(protocol) {

I am using nodejitsu http-proxy so on a http-->https proxy it seems to be sending both objects. Can you recommend a way to only run https if it and http objects exist without impacting the rest of the code? Today I plan to dig into it and test out a few ideas. thanks!

@paulwalker
Copy link

I'm not using a proxy at all and I am seeing this behavior

@naomiaro
Copy link

naomiaro commented Mar 1, 2017

Yeah the sepia library in cache.js seems to be making 2 requests like @jimmyeisenhauer mentions

@aneilbaboo
Copy link

I was just looking at this in the replayer fork. What's happening is that the function is being wrapped twice. I rewrote some of this code to add enable/disable in the replayer fork. The changes should make this easy to fix. I'll track this issue over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants