Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTPS in Spring Boot web app deployed in Azure App Service

How do I enable HTTPS for a Spring Boot web application deployed on an Azure App Service (Tomcat 8.5, Java 8)? I have the custom domain and an SSL certificate from Verisign already. Most blogs cover the embedded Tomcat server scenario and using self signed certificates, which did not help me, since I am deploying the Spring Boot web application as a WAR in the Azure Tomcat-based app service. I added the following line:

server.port=443

and deployed the web app from STS to Azure. But I don't get back any response if I access https://custom.domain.name and if I try to acccess http://custom.domain.name, I get a 404 with the following message

The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

The way I need this to work is to process HTTPS requests only and if request is made over HTTP, then force it to HTTPS.

like image 815
Web User Avatar asked Jan 28 '26 17:01

Web User


1 Answers

Listen to 80/TCP instead, because there's already TLS offloading applied to traffic before it hits your application code.

Both https://your.domain and http://your.domain will end up on 80/TCP in your app, without you handling any of the TLS.

Check out this answer for a more comprehensive explanation: https://stackoverflow.com/a/38726543/4148708

like image 140
evilSnobu Avatar answered Jan 31 '26 08:01

evilSnobu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!