且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用curl模拟来自Firefox的代理请求?

更新时间:2023-02-24 11:39:56

我已经通过


  1. 选择 Net 标签


  1. 刷新页面


  2. 右键单击要模拟的URL请求


  3. 选择cURL复制



  1. 您要模拟的URL请求现在位于剪贴板中。


In particular, I am attempting to replicate the behavior of firefox when I set it to use a proxy for https traffic.

From my tests, it appears that Firefox sends a CONNECT request to the proxy, while the following curl command directly sends GET to the proxy.

curl --proxy-basic mydomain.com:8001 https://www.google.com

How can I make curl behave like firefox for testing purposes with respect to the proxy for HTTPS connections?

EDIT1: The issue is not with the User-Agent, because I am not trying to fool the proxy into thinking I am firefox, only to help the proxy function the way it would with Firefox.

I've done this through Firebug.

Once you've installed firebug, follow this steps:

  1. Right-click a webpage inside firefox and choose this option:

  1. Select Net tab

  1. Refresh the page

  2. Right-click the URL request you want to simulate

  3. Choose copy as cURL

  1. The URL request that you want to simulate is now in your clipboard.