sepia icon indicating copy to clipboard operation
sepia copied to clipboard

Duplicate Requests being recorded

Open jimmyeisenhauer opened this issue 9 years ago • 5 comments

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'));

});

jimmyeisenhauer avatar Nov 20 '15 19:11 jimmyeisenhauer

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?

avik-das avatar Dec 21 '15 05:12 avik-das

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!

jimmyeisenhauer avatar Mar 10 '16 15:03 jimmyeisenhauer

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

paulwalker avatar Aug 03 '16 07:08 paulwalker

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

naomiaro avatar Mar 01 '17 12:03 naomiaro

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.

aneilbaboo avatar Mar 25 '17 00:03 aneilbaboo