是否可以通过将主机指定为代理来通过代理路由GET请求?或者你必须设置数据包的目的地?
我正在尝试生成HTTPRequestMessage并通过代理路由它.但是,我没有精确的级别控制来设置发送请求的目的地.
我试图通过sqlplus连接到Oracle数据库时遇到问题.
命令行如下所示:
C:\oracle\product\11.2.0\client_1>sqlplus
Error 46 initializing SQL*Plus
HTTP proxy setting has incorrect value
SP2-1502: The HTTP proxy server specified by http_proxy is not accessible
C:\oracle\product\11.2.0\client_1>http_proxy
'http_proxy' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
Run Code Online (Sandbox Code Playgroud)
根据这篇博客文章!它会引起关于http_proxy变量的值的抱怨,但是这个变量甚至不存在于客户端机器中.
有没有人在Windows上遇到同样的问题?
编辑:
对不起大家.我将http_proxy设置为用户变量.我只是想以错误的方式看待它.
错误:
C:\Users\ilson.bolzan>http_proxy
Run Code Online (Sandbox Code Playgroud)
对:
C:\Users\ilson.bolzan>echo %http_proxy%
Run Code Online (Sandbox Code Playgroud) 我正在尝试为nginx编写配置文件,我收到此错误:
/etc/nginx/conf.d/mydomain.conf:24中的未知指令"proxy_http_version"
配置文件位置: /etc/nginx/conf.d/mydomain.conf
Nginx版本:我安装了nginx/1.0.15.
这是我的配置文件.请帮我解决这个问题.
upstream node_app {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
}
server {
listen 80;
server_name mydomain.com;
# !!! handle static content requests and serve with nginx !!! #
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
root /var/www/html/mydomain.com/public/;
}
# !!! handle dynamic content requests and serve with node defined in upstream node_app object. !!! #
location ~* ^[^\.]+$ {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Apache Camel 实现一个简单的 HTTP 代理服务。我的代码如下所示:
from("jetty:http://localhost:80?matchOnUriPrefix=true")
.recipientList(simple("jetty:${in.header.CamelHttpUrl}?bridgeEndpoint=true&throwExceptionOnFailure=false&disableStreamCache=true"));
Run Code Online (Sandbox Code Playgroud)
它本质上是这样一个动态收件人列表,以支持多个目的地。我还必须添加该disableStreamCache=true位,否则我会得到路径重复的奇怪异常(就像/index.html会变成/index.html/index.html)。
尽管如此,它似乎有效。但仅限于 HTTP 请求。当我尝试访问 HTTPS 站点时,总是收到 404。
根据日志,jetty 组件似乎没有找到远程服务器。我不知道为什么。
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG org.eclipse.jetty.server.Server - REQUEST www.google.cz:443 on AsyncHttpConnection@6964b063,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=17,c=0},r=1
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.j.server.handler.ContextHandler - scope null||www.google.cz:443 @ o.e.j.s.ServletContextHandler{/,null}
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.j.server.handler.ContextHandler - context=null||www.google.cz:443 @ o.e.j.s.ServletContextHandler{/,null}
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.jetty.servlet.ServletHandler - servlet null||www.google.cz:443 -> null
01:36:37.495 [qtp85415531-22 - www.google.cz:443] DEBUG o.e.jetty.servlet.ServletHandler - chain=null
01:36:37.495 [qtp85415531-22 - www.google.cz:443] …Run Code Online (Sandbox Code Playgroud) 我正在尝试使apache服务器成为我的节点服务器的网关.
我的apache将提供静态页面,节点将充当rest api服务器.
节点和apache都位于同一台服务器上,ubuntu 64bit ec2.
我试图为https做这个并且失败了,后来我试图为代理传递打开一个http端口并且它工作了(我已经将节点更改为http以使其工作).
我的最后一招将是将节点转换为Web服务器,但我希望保持简单,因为它很快就会重构并使用meteor.
我会感激任何建议
这是我对apache的配置
<VirtualHost *:443>
ServerName secure.mysite.co.il
ServerAdmin admin@mysite.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /ssl/mysite.crt
SSLCertificateKeyFile /ssl/mysite.key
SSLCertificateChainFile /ssl/ca-bundle-client.crt
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /echo/test https://127.0.0.1:8001/echo/test
ProxyPassReverse /echo/test https://127.0.0.1:8001/echo/test
Run Code Online (Sandbox Code Playgroud)
成功的http配置
<VirtualHost *:80>
ServerAdmin admin@mysite.com
ServerName mysite.co.il
ServerAlias www.mysite.co.il
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8001/
ProxyPassReverse / http://127.0.0.1:8001/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud) 我发现javamail只支持socks。有什么解决方案可以用来支持 http 代理吗?
public class MailConnectionTest {
public static void main(String args[]) throws MessagingException {
Properties props = MailConnectionTest.getProperties();
Session session = Session.getDefaultInstance(props, null);
String protocol = "pop3";
String host = "pop.163.com";
String username = "email username";
String password = "1Qaz2wsx3edc&";
Store store = session.getStore(protocol);
store.connect(host, username, password);
System.out.println("Success");
}
private static Properties getProperties() {
Properties props = System.getProperties();
props.put("mail.debug", "false");
// Proxy
props.put("proxySet", "true");
props.put("http.proxyHost", "proxyAdderss");
props.put("http.proxyPort", "8080");
return props;
}
}
Run Code Online (Sandbox Code Playgroud) 我想使用多个http代理.根据文档,我找不到传递多个代理的方法.
这是我的代码: -
proxies = {
'http': [List of IPs]
}
r = requests.get('http://10.1.7.70:8000', proxies=proxies)
Run Code Online (Sandbox Code Playgroud)
运行此代码时,出现以下错误: -
TypeError: unhashable type: 'list'
Run Code Online (Sandbox Code Playgroud)
我如何使用多个代理?
问题是关于 HTTP 与 HTTPS 的。
如果我想匿名加载强制使用 HTTPS 的网站(例如 Google.com),我是否需要 HTTPS 代理,或者我可以使用 HTTP 代理吗?
我正在尝试从我公司网络内的服务器与图书馆获取一些数据requests。我使用 VPN 进入公司网络,并且还设置了公司代理。我尝试访问的地址仅在该公司网络内可见。
import requests
url = "http://some.private.server.net"
r = requests.get(url)
Run Code Online (Sandbox Code Playgroud)
我在我的环境中设置了 HTTP_PROXY 和 HTTPS_PROXY。我运行的是 Windows 7。
我从这段代码中得到错误 502。当我物理连接到公司网络时它起作用了,所以我认为问题在于通过 VPN 而不是代理连接。我可以使用网络浏览器访问该地址。
我对网络了解不多,但我尝试将请求的源地址更改为VPN网络适配器使用的IP地址。
import requests
from requests_toolbelt.adapters.source import SourceAddressAdapter
s = requests.Session()
ip = "y.y.y.y"
s.mount('http://', SourceAddressAdapter(ip))
s.mount('https://', SourceAddressAdapter(ip))
url = "http://some.private.server.net"
response = s.get(url)
Run Code Online (Sandbox Code Playgroud)
这仍然导致与上面相同的错误(502)。
编辑:更仔细地查看 502 错误,代理服务器返回消息“您正在查找的页面的主机名不存在”。
因此,我尝试将 URL 替换为我尝试访问的服务器的 IP 地址,但由于“网关超时”而收到 502。
我可以从命令行 ping 该 IP,没有问题。
http-proxy ×10
http ×2
https ×2
java ×2
node.js ×2
proxy ×2
python ×2
apache ×1
apache-camel ×1
c# ×1
jakarta-mail ×1
mod-proxy ×1
nginx ×1
oracle ×1
python-3.x ×1
sqlplus ×1
squid ×1
ubuntu ×1
vpn ×1
windows ×1