Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

WIP: Add support for sending event requests via proxy #370

Closed
wants to merge 27 commits into from

Conversation

ndmanvar
Copy link

Do not merge...just yet.

@ndmanvar
Copy link
Author

ndmanvar commented Sep 12, 2017

usage / test script:

var Raven = require('raven');
Raven.config('https://{PUBLIC_KEY}:{SECRET_KEY}@sentry.io/202440', {
    transport: new Raven.transports.HTTPSProxyTransport({
        proxyHost: 'localhost',
        proxyPort: 8080,
    })
}).install();

var x = {};
x.something();

http in URL -> HTTPProxyTransport
https in URL -> HTTPSProxyTransport

@@ -25,6 +27,17 @@ HTTPTransport.prototype.send = function(client, message, headers, eventId, cb) {
port: client.dsn.port || this.defaultPort,
ca: client.ca
};

// set path apprpriately when using proxy
if (this.options.hasOwnProperty('host')) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ndmanvar I think you're missing setting the Host header to be set to client.dsn.host in case of proxy.
Without it the host header would keep the proxy host which cause the HTTP request to be rejected by the sentry.io server

@ndmanvar
Copy link
Author

ndmanvar commented Oct 2, 2017

https://gist.github.com/ndmanvar/7ae7b4db7bf1cda30545c1480fde77fe

Works with https.
Host CustomTransport.js along with code, reference from Raven:

var Raven = require('raven');
var CustomTransport = require('./CustomTransport.js');

Raven.config('https://{PUBLIC_KEY}:{PRIVATE_KEY}@sentry.io/{PROJECT_ID}', {
    transport: new CustomTransport.HTTPSProxyTransport()
}).install();

var x = {};
x.something();

@ndmanvar
Copy link
Author

ndmanvar commented Oct 27, 2017

Gist is the current workaround.

@ndmanvar ndmanvar closed this Oct 27, 2017
@ndmanvar ndmanvar reopened this Oct 28, 2017
@ndmanvar
Copy link
Author

Closed this, as I am working off of new branch: #397

@ndmanvar ndmanvar closed this Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants