相关疑难解决方法(0)

如何使用mod_proxy保存通过AJP连接器发送到Apache的Tomcat HTTP响应的Content-Type标头

我在Content-Type通过AJP/1.3连接器访问Apache后面的Tomcat中托管的Axis2 Web服务时遇到了错误的HTTP响应标头问题.

我可以通过其RESTful接口在浏览器中无问题地访问Web服务,我可以看到结果,但不知何故Apache正在更改Content-TypeTomcat发送的响应头text/xml,text/plain并且它阻止我通过NetBeans中的SOAP来使用Web服务,因为一个Unsupported Content-Type: text/plain Supported ones are: [text/xml]例外.

这是我的Apache vhosts配置的相关部分:

<VirtualHost *:80>
    ServerAdmin me@myserver.example
    ServerName  myserver.example
    ServerAlias other.myserver.example

    ProxyPreserveHost On 
    SetEnv force-proxy-request-1.0 1
    SetEnv proxy-nokeepalive 1

    <Location /axis2/services>
        ProxyPass ajp://localhost:8009/axis2/services
        ProxyPassReverse ajp://localhost:8009/axis2/services
    </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

以及我的Tomcat server.xml的相关部分:

<Connector port="8009" protocol="AJP/1.3" redirectPort="9443" />

<Connector port="9443" protocol="HTTP/1.1" SSLEnabled="true" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" disableUploadTimeout="true"
    acceptCount="100" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS"
    SSLCertificateFile="path/to/bundle" 
    SSLCertificateKeyFile="path/to/key"
    SSLPassword="S3cr3t"
    proxyName="myserver.example" proxyPort="443" />
Run Code Online (Sandbox Code Playgroud)

如果我使用端口8080上的默认连接器直接在Tomcat中访问WS,我得到了正确content-type但如果我通过Apache访问它然后我得到text/plain,所以这肯定是代理问题.

我怎么解决这个问题?

编辑: …

apache proxy tomcat axis2 content-type

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

apache ×1

axis2 ×1

content-type ×1

proxy ×1

tomcat ×1