dongsu1951 2018-11-21 07:06 采纳率: 0%
浏览 746
已采纳

如何在我的HTTP请求中使用带有身份验证的代理?

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:

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".

  • 写回答

2条回答 默认 最新

  • douwen5833 2018-11-21 07:18
    关注

    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)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退