में एसएसएल और गैर-एसएसएल दोनों का उपयोग करना मेरे पास टॉमकैट 6 सर्वर है और मैं बस सब कुछ एसएसएल के पीछे होना चाहता हूं, हालांकि मैं चाहता हूं कि एक सर्वलेट गैर-एसएसएल के माध्यम से सुलभ हो। क्या इस तरह टोमकैट को कॉन्फ़िगर करना संभव है? यह वर्तमान में सुरक्षित बंदरगाह पर सभी अनुरोधों को अग्रेषित करने के लिए स्थापित है।टॉमकैट 6
Q
टॉमकैट 6
5
A
उत्तर
5
इसे प्राप्त करने का एक तरीका है अपने वेब ऐप के लिए web.xml को संपादित करना।
मुझे लगता है आप पहले से ही की तरह नीचे
<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/*</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this area -->
<role-name>tomcat</role-name>
<role-name>role1</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
अब सर्वलेट आप के लिए https बायपास करने के लिए इच्छा के लिए यह नीचे एक और खंड जोड़ें <transport-guarantee> CONFIDENTIAL
के साथ https करने के लिए सभी अनुरोधों को मजबूर कर के लिए स्थापित वेब अनुप्रयोग होगा।
<security-constraint>
<web-resource-collection>
<web-resource-name>Unsecured resources</web-resource-name>
<url-pattern>/jsp/openforall.jsp</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
यह URL openforall.jsp अकेले ही http के माध्यम से पहुंचा जायेगा।
नोट: यह यूआरएल अभी भी https पर उपलब्ध होगा अगर कोई इसे इस तरह से एक्सेस करता है।