java - How to redirect automatically to https with Spring Boot started on command line -


I have the same question but not in the context of EC2, just starting the bus boot application from the command line the following code while running with HTTPS managed to get your application:

  @Profile ( "Security") @Configuration public square SecurityConfiguration {@Bean public EmbeddedServletContainerCustomizer containerCustomizer (@value ( "$ {. keystore.file}") resource keystoreFile, @value ( "$ {keystore.pass}") final string keystorePass) IOException {final string absoluteKeystoreFile = keystoreF Ile.getFile () throws getAbsolutePath (); New EmbeddedServletContainerCustomizer () {@Override public void optimized (ConfigurableEmbeddedServletContainer container) {TomcatEmbeddedServletContainerFactory badge = (TomcatEmbeddedServletContainerFactory) container return; TomcatkaddConnectorCustomizers (New TomcatConnectorCustomizer () {@Override public void optimized (connector, connector) {connector.setPort (8443); connector.setSecure (right); connector.setScheme ( "https"); Http11NioProtocol proto = (Http11NioProtocol) connector . getProtocolHandler (); proto.setSSLEnabled (right); proto.setKeystoreFile (absoluteKeystoreFile); proto.setKeystorePass (keystorePass); proto.setKeystoreType ( "PKCS12"); proto.setKeyAlias ​​( "Insignia");}}); }}; }}  

So now I can access my code at https: // localhost: 8443 / .

I think that http: // localhost: 8443 will need to redirect to https. Now Chrome detects: "No data found" that is not very user-friendly

AFAIK can you ' By doing so: If Tommack Port is listening for HTTPS at 8443, then he can not listen to HTTP on the same ports. The second question that was linked to you was different in that it was not about a specific port.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -