How to use proxies with authentication in my HTTP requests?
I have a proxy IP Address (that also require a username and password). When i try using them to visit webpages, i get "Proxy Authentication Required".
I'm found this other Stackoverflow post from 2016, and this Github Issue that was closed, but they don't provide anything useful:
- Proxy golang https
- https://github.com/golang/go/issues/22288
Any suggestions?
EDIT:
Saw this post: Setting up proxy for HTTP client
It's kinda close. However, for some urls I'm able to get a successful response using my proxy, but for certain urls, I get a "Proxy Authorization Required".
go proxy get request
add a comment |
I have a proxy IP Address (that also require a username and password). When i try using them to visit webpages, i get "Proxy Authentication Required".
I'm found this other Stackoverflow post from 2016, and this Github Issue that was closed, but they don't provide anything useful:
- Proxy golang https
- https://github.com/golang/go/issues/22288
Any suggestions?
EDIT:
Saw this post: Setting up proxy for HTTP client
It's kinda close. However, for some urls I'm able to get a successful response using my proxy, but for certain urls, I get a "Proxy Authorization Required".
go proxy get request
Possible duplicate of Setting up proxy for HTTP client
– danicheeta
Nov 21 '18 at 7:34
add a comment |
I have a proxy IP Address (that also require a username and password). When i try using them to visit webpages, i get "Proxy Authentication Required".
I'm found this other Stackoverflow post from 2016, and this Github Issue that was closed, but they don't provide anything useful:
- Proxy golang https
- https://github.com/golang/go/issues/22288
Any suggestions?
EDIT:
Saw this post: Setting up proxy for HTTP client
It's kinda close. However, for some urls I'm able to get a successful response using my proxy, but for certain urls, I get a "Proxy Authorization Required".
go proxy get request
I have a proxy IP Address (that also require a username and password). When i try using them to visit webpages, i get "Proxy Authentication Required".
I'm found this other Stackoverflow post from 2016, and this Github Issue that was closed, but they don't provide anything useful:
- Proxy golang https
- https://github.com/golang/go/issues/22288
Any suggestions?
EDIT:
Saw this post: Setting up proxy for HTTP client
It's kinda close. However, for some urls I'm able to get a successful response using my proxy, but for certain urls, I get a "Proxy Authorization Required".
go proxy get request
go proxy get request
edited Nov 21 '18 at 21:27
Matthew Chan
asked Nov 21 '18 at 7:06
Matthew ChanMatthew Chan
1,11641738
1,11641738
Possible duplicate of Setting up proxy for HTTP client
– danicheeta
Nov 21 '18 at 7:34
add a comment |
Possible duplicate of Setting up proxy for HTTP client
– danicheeta
Nov 21 '18 at 7:34
Possible duplicate of Setting up proxy for HTTP client
– danicheeta
Nov 21 '18 at 7:34
Possible duplicate of Setting up proxy for HTTP client
– danicheeta
Nov 21 '18 at 7:34
add a comment |
2 Answers
2
active
oldest
votes
If you're following this authorized proxy tutorial, the additional step you would have to do is to set up the HEADER in the transport.
auth := "username:password"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
transport.ProxyConnectHeader = http.Header{}
transport.ProxyConnectHeader.Add("Proxy-Authorization", basicAuth)
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
1
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
add a comment |
to add authorization, you may need to add a header:
auth := "{user}:{password}"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
request.Header.Add("Proxy-Authorization", basicAuth)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406874%2fhow-to-use-proxies-with-authentication-in-my-http-requests%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you're following this authorized proxy tutorial, the additional step you would have to do is to set up the HEADER in the transport.
auth := "username:password"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
transport.ProxyConnectHeader = http.Header{}
transport.ProxyConnectHeader.Add("Proxy-Authorization", basicAuth)
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
1
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
add a comment |
If you're following this authorized proxy tutorial, the additional step you would have to do is to set up the HEADER in the transport.
auth := "username:password"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
transport.ProxyConnectHeader = http.Header{}
transport.ProxyConnectHeader.Add("Proxy-Authorization", basicAuth)
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
1
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
add a comment |
If you're following this authorized proxy tutorial, the additional step you would have to do is to set up the HEADER in the transport.
auth := "username:password"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
transport.ProxyConnectHeader = http.Header{}
transport.ProxyConnectHeader.Add("Proxy-Authorization", basicAuth)
If you're following this authorized proxy tutorial, the additional step you would have to do is to set up the HEADER in the transport.
auth := "username:password"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
transport.ProxyConnectHeader = http.Header{}
transport.ProxyConnectHeader.Add("Proxy-Authorization", basicAuth)
answered Nov 21 '18 at 7:18
JuanJuan
1063
1063
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
1
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
add a comment |
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
1
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
awesome, this actually worked!!
– Matthew Chan
Nov 21 '18 at 7:23
1
1
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
If there are other headers required by the request, such as Content-Type or Accept, you should also add them to the ProxyConnectHeader.
– Juan
Nov 21 '18 at 19:07
add a comment |
to add authorization, you may need to add a header:
auth := "{user}:{password}"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
request.Header.Add("Proxy-Authorization", basicAuth)
add a comment |
to add authorization, you may need to add a header:
auth := "{user}:{password}"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
request.Header.Add("Proxy-Authorization", basicAuth)
add a comment |
to add authorization, you may need to add a header:
auth := "{user}:{password}"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
request.Header.Add("Proxy-Authorization", basicAuth)
to add authorization, you may need to add a header:
auth := "{user}:{password}"
basicAuth := "Basic " + base64.StdEncoding.EncodeToString(byte(auth))
request.Header.Add("Proxy-Authorization", basicAuth)
answered Nov 21 '18 at 7:56
danicheetadanicheeta
994517
994517
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406874%2fhow-to-use-proxies-with-authentication-in-my-http-requests%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of Setting up proxy for HTTP client
– danicheeta
Nov 21 '18 at 7:34