Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1543

How can I enable https requests in a spring boot API?

$
0
0

I configired my spring boot API to receive https requests through a SSL self-signed certificate. When I request via postman its works, but when our frontend application(with SSL certificate too) makes the same request a problem occours.

enter image description here

The API code below:

application.properties

#server portserver.port=5001server.ssl.key-alias=https-exampleserver.ssl.key-store=classpath:https-example.jksserver.ssl.key-store-type=JKSserver.ssl.key-password=xxxxxserver.ssl.enabled=true

SSOApplication

@Bean    public ServletWebServerFactory servletContainer() {        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();        // HTTP Connector        Connector httpConnector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);        httpConnector.setScheme("http");        httpConnector.setPort(5002); // HTTP port        tomcat.addAdditionalTomcatConnectors(httpConnector);        // HTTPS Connector        Connector httpsConnector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);        httpsConnector.setScheme("https");        httpsConnector.setSecure(true);        httpsConnector.setPort(443); // HTTPS port        httpsConnector.setAttribute("keystoreFile", "src/main/resources/https-example.jks");        httpsConnector.setAttribute("keystorePass", "xxxx");        httpsConnector.setAttribute("keyAlias", "https-example");        tomcat.addAdditionalTomcatConnectors(httpsConnector);        return tomcat;    }

I need help to solve this problem


Viewing all articles
Browse latest Browse all 1543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>