Web User
Web User

Reputation: 7736

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.

Upvotes: 3

Views: 2089

Answers (1)

evilSnobu
evilSnobu

Reputation: 26354

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

Upvotes: 3

Related Questions