【发布时间】:2013-05-14 07:06:25
【问题描述】:
我使用nc 做了一个简单的代理服务器,这里是单行:
mkfifo queueueue
nc -l 8080 <queueueue | nc http://$JENKINS_HOSTNAME 80 >queueueue
它侦听端口 8080,然后将数据转发到与我们的 Jenkins 服务器的连接。 Jenkins 在 VPN 后面,我运行此代理的机器具有 VPN 访问权限。
在我的另一台机器上(没有 VPN 访问),我想curl Jenkins 服务器,这里是通过代理发起请求的命令:
http_proxy=10.1.10.10:8080 curl --user $JENKINS_USERNAME:$JENKINS_PASSWORD http://$JENKINS_HOSTNAME/api/json
客户端和代理机器在同一个网络,我可以在它们之间ping和ssh,另外,我知道客户端正在连接代理服务器,我认为客户端尝试时会出现故障验证,这是我尝试 curl 时的输出:
$ http_proxy=10.1.10.10:8080 curl --user $JENKINS_USERNAME:$JENKINS_PASSWORD http://$JENKINS_HOSTNAME/api/json
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="<some other url>">here</a>.</p>
<hr>
<address>Apache Server at $JENKINS_HOSTNAME Port 80</address>
</body></html>
如何使用 HTTP 基本身份验证通过这样的代理进行 curl?
【问题讨论】:
标签: proxy netcat basic-authentication