cruvex
Cannot access Spring Boot API when it is deployed with https
Hi
When I run my Spring Boot application locally in IntelliJ or deploy it to docker desktop I can access my with the following link
https://localhost:8080/endpoint
This uses a Self-Signed Certificate configured like this in application.yml
:
logging:
level:
org.springframework.web.filter.CommonsRequestLoggingFilter: DEBUG
pattern:
console: "[%d{yyyy-MM-dd HH:mm:ss - Z}] - %msg%n"
server:
port: ${PORT:8080}
ssl:
key-store: classpath:springboot.jks
key-store-password: xxx
key-store-type: JKS
key-alias: springboot
However when I deploy the application (Using railway up) with the above config I cannot access my API via the railway provided domain.
I keep getting the following response:
400 Bad Request
This combination of host and port requires TLS.
Also when I remove the ssl config from my application.yml
so that my application uses http instead of https everything works like I want. But I'm told its better to have it run on https even if Railways domain is https.
FYI: I am completely new to Spring Boot and web security.9 replies