我在尝试使用Apache的代理模块发布到HTTPS端点时遇到了一些问题。发送到HTTP端点的工作正常。我对Apache配置很新,所以我希望你们中的一个人能够对我做错了什么有所了解。谷歌对这个特殊问题没有多大帮助。我已经读过的一个帖子的例子是(我没有足够的声誉来发布更多链接):
托管服务器网站的示例端点,以及代理:http://websiteAndProxyServer.com
发布到的示例端点:https://secureServer.com/AccessManagerSOAP
以下是我正在尝试做的一般概念:
HTTP - >代理 - > HTTPS
代理允许我解决跨域请求问题。
Apache版本:2.2.21
jQuery post request:
var url = "http://websiteAndProxyServer.com/idm/AccessManagerSOAP";
$.ajax({
url:url,
type:'POST',
data: loginRequest,
success: createUserAndAuthenticateSuccess,
error: createUserAndAuthenticateError
});
httpd.conf中的相关Apache配置:
#=============mod-proxy==================
# UnComment the proxy_module, proxy_balancer_module & proxy_ajp_module below to
# use ModProxy for enabling different JSessionID cookie names to be provided.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
SSLProxyEngine On
ProxyPass /remote/ http://nonRelatedServer.net:8082/
ProxyPass /idm/ https://secureServer.com/
httpd-ssl.conf中的相关Apache配置
##
## SSL Virtual Host Context
##
NameVirtualHost *:443
<VirtualHost _default_:443>
DocumentRoot "/usr/local/apache2/htdocs"
# ServerName websiteAndProxyServer.com
# ServerAlias www.dummy-host.example.com
ErrorLog "|/usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/localhost/error_log.%Y-%m-%d 86400"
CustomLog "|/usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/localhost/access_log.%Y-%m-%d 86400" vcombined2
RewriteEngine on
RewriteOptions inherit
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
#SSLEnable #I get an error if this is un-commented
SSLEngine on
SSLProxyEngine on
# SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
SSLCipherSuite DEFAULT:!ADH::RC4+RSA:+HIGH:+MEDIUM:!LOW:!SSLv2:+eNULL
# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.)
SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
#SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server-dsa.crt
SSLProxyCACertificateFile /usr/local/apache2/conf/ssl.crt/iam.crt
#SSLProxyCACertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
我尝试从目标网址获取证书,并通过上面的iam.crt参考引用它们。这似乎没有什么区别。
通过上述配置,我得到以下内容:
<?xml version='1.0' ?>
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Body>
<env:Fault>
<faultcode>env:Client</faultcode>
<faultstring>Internal Error</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
请注意,我收到的HTTP代码是200.当我通过SoapUI向上述端点发送类似的请求时,我获得了成功,所以它必须与我的配置或权限有关。我缺少配置的其他内容吗?
任何建议表示赞赏。
答案 0 :(得分:0)
事实证明,我的配置完全没有问题。相反,我的肥皂请求格式不正确。我没有在肥皂信封里面包含这个请求。进行此更改后,请求恢复正常。
旧请求:
<?xmlversion="1.0"encoding="UTF-8"standalone="yes"?>
<accountCreateRequestxmlns="http://schemaSite.com/schema/">
<namespaceId>50000003</namespaceId>
<emailAddress>7e837231-7a3d-495a@g88.net</emailAddress>
<password>infdafs</password>
<generateLoginName>false</generateLoginName>
<loginName>7e837231-7a3d-495a@g88.net</loginName>
<securityQuestion></securityQuestion>
<securityAnswer></securityAnswer>
<securityLevel>LOW</securityLevel>
</accountCreateRequest>
新请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mes="http://schemaSite.com/messages/">
<soapenv:Header/>
<soapenv:Body>
<mes:accountCreateRequest>
<mes:namespaceId>50000003</mes:namespaceId>
<mes:emailAddress>7e837231-7a3d-495a@g88.net</mes:emailAddress>
<mes:password>!fdsuit01</mes:password>
<mes:generateLoginName>false</mes:generateLoginName>
<mes:loginName>7e837231-7a3d-495a@g88.net</mes:loginName>
<mes:securityQuestion></mes:securityQuestion>
<mes:securityAnswer></mes:securityAnswer>
<mes:securityLevel>LOW</mes:securityLevel>
</mes:accountCreateRequest>
</soapenv:Body>
</soapenv:Envelope>