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

[Storage] Proxy support for storage-blob #2928

Merged
merged 3 commits into from
Jun 18, 2019

Conversation

HarshaNalluru
Copy link
Member

No description provided.

@HarshaNalluru HarshaNalluru added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels May 15, 2019
@HarshaNalluru HarshaNalluru self-assigned this May 15, 2019
@HarshaNalluru HarshaNalluru force-pushed the ProxySupportStorage branch from ef555d1 to 43db3b8 Compare June 1, 2019 00:26

// Use sharedKeyCredential, tokenCredential or anonymousCredential to create a pipeline
const pipeline = StorageClient.newPipeline(sharedKeyCredential, {
proxyOptions: { proxySettings: "http://localhost:3128" }
Copy link
Member Author

@HarshaNalluru HarshaNalluru Jun 1, 2019

Choose a reason for hiding this comment

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

If https is used instead of http, the test fails with this error.

tunneling socket could not be established, cause=write EPROTO 6156:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252:

Needs more investigation.

cc: @bterlson

Copy link
Member

Choose a reason for hiding this comment

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

@HarshaNalluru It's a known bug of axios 0.18.0 when enable proxy over https.

ms-rest-js @kpajdzik did some workaround in this change (Azure/ms-rest-js#322). But storage SDK may not update to use the ms-rest-js version with the fix, please have a check. And if necessary, you can update ms-rest-js version

Copy link
Member

Choose a reason for hiding this comment

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

It's likely an issue in the underlying axios library.

Harsha already verified that http works fine. Maybe we can merge this PR and track the external https issue separately.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Are we sure this is an Axios problem and not the proxy server not supporting HTTPS? HTTPS on proxies is hard to set up as you need a trusted root certificate to man-in-the-middle the connection without generating certificate validation errors.

Copy link
Member

Choose a reason for hiding this comment

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

I ran a squid container on my azure VM and tested that the proxy server is working using request library

var request = require('request');

request({
  'url':'https://docs.microsoft.com/en-us/rest/api/securitycenter/',
  'method': "GET",
  'proxy':'http://<server-ip>:3128'
},function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body);
  } else {
    console.log("Error!!!" + error);
  }
})

Copy link
Member

Choose a reason for hiding this comment

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

The proxy there is HTTP, however, so you're talking HTTP to the proxy and the proxy is talking HTTPS to the endpoint. Try with https for proxy.

Copy link
Member

Choose a reason for hiding this comment

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

ah, proxy with https gave the same error

Error: tunneling socket could not be established, cause=write EPROTO 41488:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:252:

Copy link
Member Author

@HarshaNalluru HarshaNalluru Jun 5, 2019

Choose a reason for hiding this comment

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

Created a new issue - #3465


// Use sharedKeyCredential, tokenCredential or anonymousCredential to create a pipeline
const pipeline = StorageClient.newPipeline(sharedKeyCredential, {
proxyOptions: { proxySettings: "http://localhost:3128" }
Copy link
Member

Choose a reason for hiding this comment

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

proxyOptions.proxySettings seems strange to me. Can we do proxyOptions.url instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


// Use sharedKeyCredential, tokenCredential or anonymousCredential to create a pipeline
const pipeline = StorageClient.newPipeline(sharedKeyCredential, {
proxyOptions: { proxySettings: "http://localhost:3128" }
Copy link
Member

Choose a reason for hiding this comment

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

@HarshaNalluru It's a known bug of axios 0.18.0 when enable proxy over https.

ms-rest-js @kpajdzik did some workaround in this change (Azure/ms-rest-js#322). But storage SDK may not update to use the ms-rest-js version with the fix, please have a check. And if necessary, you can update ms-rest-js version

@HarshaNalluru HarshaNalluru marked this pull request as ready for review June 14, 2019 08:30

// Use sharedKeyCredential, tokenCredential or anonymousCredential to create a pipeline
const pipeline = StorageClient.newPipeline(sharedKeyCredential, {
proxyOptions: { url: "http://localhost:3128" }
Copy link
Member

Choose a reason for hiding this comment

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

Let's rename this option to proxy since it's already in an option type, Options seems redundant. Otherwise LGTM!

@HarshaNalluru HarshaNalluru requested a review from bterlson June 18, 2019 22:51
Copy link
Member

@jeremymeng jeremymeng left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremymeng jeremymeng merged commit 1aecdd6 into Azure:feature/storage Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants