R
Railway10mo ago
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.
Solution:
you need to run your app as http, there is no benefits to running it as https when railway handles https for you
Jump to solution
6 Replies
Percy
Percy10mo ago
Project ID: 1c1e74f2-8962-4a5f-b99b-7faaab00213e
cruvex
cruvex10mo ago
1c1e74f2-8962-4a5f-b99b-7faaab00213e
Solution
Brody
Brody10mo ago
you need to run your app as http, there is no benefits to running it as https when railway handles https for you
cruvex
cruvex10mo ago
I need to because there is no other option or because thats the (best) way to do it?
Brody
Brody10mo ago
there is no other option your app needs to be running as http when on railway
cruvex
cruvex10mo ago
Ok. Thanks for the quick replies. This can be closed or smth ig
Want results from more Discord servers?
Add your server