我是 Spring Boot 的新手。
我正在尝试对服务进行 https 调用,我有一个私有密钥来保护连接。
我打:
http://localhost:8081/points/12345/search
Run Code Online (Sandbox Code Playgroud)
我尝试使用 https:// 但我从邮递员那里得到:
Could not get any response
There was an error connecting to https://localhost:8081/points/12345/search.
Run Code Online (Sandbox Code Playgroud)
从我写的那一刻起
server.ssl.key-store=classpath:KeyStore.jks
server.ssl.key-store-password=test
Run Code Online (Sandbox Code Playgroud)
在application.properties,我收到错误消息:
错误请求 - 这种主机和端口的组合需要 TLS
我已经删除了我的控制器中的所有代码,我只是让端点以便我可以调用它。
@RestController
@SpringBootApplication
public class MainApplication {
@RequestMapping(value = "/points/{point}/search", method = RequestMethod.GET)
public PointsType getPoint(@PathVariable(value = "point") String point) {
System.out.println("hi"); // Never printed
return null;
}
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
这是文件 application.properties:
spring.application.name=sge
server.port=8081
server.ssl.key-store=classpath:KeyStore.jks
server.ssl.key-store-password=test
server.ssl.key-alias=homologation-staging
server.ssl.trust-store=classpath:TrustStore.jks
server.ssl.trust-store-password=test
server.ssl.client-auth=need
security.require-ssl=true
server.tomcat.remote_ip_header=x-forwarded-for
server.tomcat.protocol_header=x-forwarded-proto
Run Code Online (Sandbox Code Playgroud)
我该怎么办 ?
小智 45
我https://在开始时使用而不是http://,它对我有用。
| 归档时间: |
|
| 查看次数: |
87925 次 |
| 最近记录: |