用apache配置好之后,正常启动,在浏览器设置好代理,可以正常上网,也可以浏览https网站,但是用代码向一个https网站发送报文总是报错“"HTTP/1.1 403 Proxy Error”,apache的日志上AH00898: Connect to remote machine blocked returned by 我要发送的url,屡次不成功后我怀疑代码的问题,上网找了一个免费的https代理服务器实验,结果发送成功有正确响应,看来就是apache配置的问题,但无论如何找不到问题所在apache部分配置
    #正向代理设置
    ProxyRequests On
    ProxyVia On     <Proxy *>
       Order deny,allow
       Deny from all
#      Allow from all
       Allow from 127.0.0.1
  </Proxy>httpclient部分代码public HttpURLConnection connect(String url, String method) throws MalformedURLException, IOException {
SocketAddress addr = new InetSocketAddress("",8048);
Proxy typeProxy = new Proxy(Proxy.Type.HTTP,addr);
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(typeProxy);
connection.setConnectTimeout(600);
// HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
if (sslSocketFactory != null) {
HttpsURLConnection httpsConn = (HttpsURLConnection) connection;
httpsConn.setSSLSocketFactory(sslSocketFactory);
if (sslConfig.ignoreHostname) {
httpsConn.setHostnameVerifier(ignoreHostnameVerifier);
}
}
connection.setConnectTimeout(config.connectTimeout);
connection.setReadTimeout(config.readTimeout);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestMethod(method);
connection.setRequestProperty("User-Agent", httpConfig.userAgent);
connection.setRequestProperty("Connection", httpConfig.connection);
connection.setRequestProperty("Content-Type", httpConfig.contentType + ";charset=" + config.charset);
connection.setRequestProperty("Accept", httpConfig.accept);
connection.setRequestProperty("Accept-Charset", config.charset);
// NOT connect, delay until send() for set length
return connection;
}