मैंने अपने स्प्रिंग बूट एप्लिकेशन को तैनात किया है जो एक उबंटू सर्वर में सुरक्षा के लिए वसंत सुरक्षा का उपयोग कर रहा है। इसलिए, मुझे एक समस्या है। मैं केवल यूआरएल का उपयोग करके अपने आवेदन तक पहुंच सकता हूं जैसे:https://example.com:8443. मैं ८४४३ के बंदरगाह का उपयोग क्यों करूं? ऐसा लगता है कि वसंत सुरक्षा ८४४३ के बंदरगाह का उपयोग कर रही है। com" rel="nofollow noreferrer">www.example.com? मेरा संबंधित कोड इस प्रकार है:
spring.freemarker.cache=false
spring.datasource.url=jdbc:mysql://MyIp:3306/keziqu?serverTimezone=UTC
spring.datasource.username=user
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
server.port=8443
server.ssl.key-store=classpath:**.pfx
server.ssl.key-store-password=password
#server.ssl.key-password=another-secret
logging.file.path=./log/
#logging.level.org.springframework.security=debug
@Configuration
public class TomcatConfig {
@Bean
TomcatServletWebServerFactory tomcatServletWebServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(){
@Override
protected void postProcessContext(Context context) {
SecurityConstraint constraint = new SecurityConstraint();
constraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
constraint.addCollection(collection);
context.addConstraint(constraint);
}
};
factory.addAdditionalTomcatConnectors(createTomcatConnector());
return factory;
}
private Connector createTomcatConnector() {
Connector connector = new
Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(80);
connector.setSecure(false);
connector.setRedirectPort(8443);
return connector;
}
}
1 उत्तर
यदि आप पोर्ट निर्दिष्ट किए बिना अपनी वेबसाइट पर जाना चाहते हैं, तो आपको यह सुनिश्चित करना होगा कि यह डिफ़ॉल्ट पोर्ट पर चल रही है।
डिफ़ॉल्ट सुरक्षित HTTP (https://) पोर्ट 443 है।
डिफ़ॉल्ट असुरक्षित HTTP (http://) पोर्ट 80 है।
संबंधित सवाल
नए सवाल
java
जावा एक उच्च स्तरीय प्रोग्रामिंग भाषा है। इस टैग का उपयोग तब करें जब आपको भाषा का उपयोग करने या समझने में समस्या हो। इस टैग का उपयोग शायद ही कभी किया जाता है और इसका उपयोग अक्सर [वसंत], [वसंत-बूट], [जकार्ता-ई], [Android], [javafx], [हडूप], [श्रेणी] और [मावेन] के साथ किया जाता है।