title: How can I configure embedded tomcat to listen to port 80 and 8443?
body: <p>I am using embedded Tomcat with Spring and I configured it programmatically to listen to port 8443 for https and it works. Below is my code snippet from my Apllication.java file. How can I configure it to also listen to port 80 for http requests?</p>
  
  <pre><code>@Bean
      EmbeddedServletContainerCustomizer containerCustomizer(
              @Value("${keystore.file:src/main/resources/private/keystore}") String keystoreFile,
              @Value("${keystore.pass:changeit}") final String keystorePass) throws Exception {
  
  
          final String absoluteKeystoreFile = new File(keystoreFile).getAbsolutePath();
  
          return new EmbeddedServletContainerCustomizer () {
  
              @Override
              public void customize(ConfigurableEmbeddedServletContainer container) {
                      TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
  
  
  
                      tomcat.addConnectorCustomizers(
                              new TomcatConnectorCustomizer() {
                                  @Override
                                  public void customize(Connector connector) {
                                      connector.setPort(8443);
                                      connector.setSecure(true);
                                      connector.setScheme("https");
  
                                      Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
                                      proto.setSSLEnabled(true);
                                      proto.setKeystoreFile(absoluteKeystoreFile);
                                      proto.setKeystorePass(keystorePass);
                                      proto.setKeystoreType("JKS");
                                      proto.setKeyAlias("tomcat");
  
                                  }
                              });
  
  
  
              }
          };
      }
  </code></pre>