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

Proxy #355

Closed
wants to merge 3 commits into from
Closed

Proxy #355

wants to merge 3 commits into from

Conversation

nickdk
Copy link

@nickdk nickdk commented Sep 10, 2014

Had some problems with using a proxy while uploading code through the grunt-aws-s3 module, apparently the proxy at our company was trying to use the aws secret in the Authorization header as the proxy credentials which of course always fails and results in a http 407. This seems to be fixed if the Proxy-Authorization header is set with the actual proxy credentials. Not entirely sure but it could be that these issues are related and possibly fixed:

#108
#26

@lsegal
Copy link
Contributor

lsegal commented Sep 10, 2014

It looks like there are some linting failures with this change. Also, it would be great if you could write a test that covers this new scenario.

That said, is BASIC the only authentication type there is for Proxy-Authentication? If not, we may be introducing more bugs here.

FWIW in the meantime you can always inject arbitrary headers to requests. You can even use global events to inject the header into every request:

AWS.events.on('build', function(req) {
  var httpOptions = req.service.config.httpOptions || {};
  if (httpOptions.proxy && req.httpRequest.endpoint.auth !== undefined) {
    req.httpRequest.headers['Proxy-Authorization'] = 'BASIC ' +
      new Buffer(req.httpRequest.endpoint.auth).toString('base64');
  }
});

@nickdk
Copy link
Author

nickdk commented Sep 10, 2014

Fixed the lint failure, I'll see if I can write a testcase for this when I've got some time to spare.

Good point about BASIC not being the only authentication scheme but I'm not really sure if it could potentially introduce more bugs, currently proxy authentication isn't working for any scheme I assume.

Since we're doing deployment through the grunt-aws-s3 module I'm unsure we can use the global events to inject the header.

Thanks for the feedback.

@lsegal
Copy link
Contributor

lsegal commented Sep 10, 2014

@nickdk you should be able to use the AWS.events. The events object is global and shared across your process. require('aws-sdk') is guaranteed to be the same AWS object used by the grunt module (assuming it's in the same process).

@AdityaManohar
Copy link
Contributor

@nickdk thanks for the pull request!

We've deliberated on this issue for some time, and given the many different proxy server implementations and protocols, we think the best way to support proxies is to configure the SDK to use an http.Agent that implements proxy support.

There a number of http.Agent implementations available like proxy-agent and tunnel-agent that do implement proxy support. The SDK can easily be configured to use these implementations instead of the default native http.Agent.

We've documented how to configure the SDK with an http.Agent implementation that supports proxies in our developer guide. We've also written a blog post that describes using the SDK from behind a proxy.

I'm going to mark this as closed because there is no plan to build proxy support in the SDK at this time.

Feel free to open an issue if you have any questions, and thanks again!

@nickdk
Copy link
Author

nickdk commented May 21, 2015

Thanks @AdityaManohar, forgot that this pull request was actually still open. I think we're still using my fork at my company to support our proxy, so thanks for the developer guide to do this properly. We'll start using this solution so we can ditch my fork as soon as possible.

@lock
Copy link

lock bot commented Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants