简体   繁体   中英

Java web app serve both secure and insecure resource

I am writing a Java web app (spring 3.2).

Basically, I have several sites that need to access my web service. These sites are a mixture of both secured (ssl) and insecured. I have an endpoint /validate/{id} that should respond to both secured requests

 (https://localhost:8443/ws/validate/123 and http://localhost:8080/ws/validate/123)

How do I do this? I've added

<security-constraint>
    <web-resource-collection>
        <web-resource-name>ws</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

to my web.xml, but that only forces ssl ( calls to 8080 get a 302 FOUND response with a Location header pointing to 8443.

How do I allow both secured and insecured requests on the same endpoint (with different ports)?

 <transport-guarantee>NONE</transport-guarantee>

似乎已经解决了问题...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM