Forward Apache ssl port 443 to Tomcat http port












0















I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.



My httpd.conf is as below:



    Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website


My ssl.conf is as below:



Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>


My server.xml connector is as below:



<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />


Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.










share|improve this question

























  • Why can't you just use 443 on the app?

    – elken
    Nov 16 '18 at 8:27











  • try moving the ProxyPass directives inside the VirtualHost

    – Eugène Adell
    Nov 16 '18 at 11:07


















0















I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.



My httpd.conf is as below:



    Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website


My ssl.conf is as below:



Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>


My server.xml connector is as below:



<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />


Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.










share|improve this question

























  • Why can't you just use 443 on the app?

    – elken
    Nov 16 '18 at 8:27











  • try moving the ProxyPass directives inside the VirtualHost

    – Eugène Adell
    Nov 16 '18 at 11:07
















0












0








0








I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.



My httpd.conf is as below:



    Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website


My ssl.conf is as below:



Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>


My server.xml connector is as below:



<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />


Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.










share|improve this question
















I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.



My httpd.conf is as below:



    Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website


My ssl.conf is as below:



Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>


My server.xml connector is as below:



<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />


Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.







apache ssl tomcat8 proxypass






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 11:12









Eugène Adell

2,11521025




2,11521025










asked Nov 16 '18 at 8:25









HimanshuHimanshu

4301518




4301518













  • Why can't you just use 443 on the app?

    – elken
    Nov 16 '18 at 8:27











  • try moving the ProxyPass directives inside the VirtualHost

    – Eugène Adell
    Nov 16 '18 at 11:07





















  • Why can't you just use 443 on the app?

    – elken
    Nov 16 '18 at 8:27











  • try moving the ProxyPass directives inside the VirtualHost

    – Eugène Adell
    Nov 16 '18 at 11:07



















Why can't you just use 443 on the app?

– elken
Nov 16 '18 at 8:27





Why can't you just use 443 on the app?

– elken
Nov 16 '18 at 8:27













try moving the ProxyPass directives inside the VirtualHost

– Eugène Adell
Nov 16 '18 at 11:07







try moving the ProxyPass directives inside the VirtualHost

– Eugène Adell
Nov 16 '18 at 11:07














1 Answer
1






active

oldest

votes


















0














Two steps:



1 Firts confirm your Tomcat is ok.



Make sure you can connect to http://localhost:7778/website and get the expected response.



Then, for proxy support modify your Connector:



<Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />


2 Fix your Apache configuration



Here I assume:




  • when you try http://www.example.com you are redirected to https://www.example.com


  • when you try https://www.example.com you get the response from Tomcat



    Listen 80
    <VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com

    CustomLog "logs/80_access.log" combined
    ErrorLog "logs/80_error.log"

    Redirect / https://www.example.com
    </VirtualHost>

    <VirtualHost *:443>
    ServerName www.example.com
    ServerAlias example.com

    # While debugging
    LogLevel debug
    CustomLog "logs/443_access.log" combined
    ErrorLog "logs/443_error.log"

    SSLEngine On
    SSLCertificateFile /path/to/certificate/file
    SSLCertificateKeyFile /path/to/key

    # Proxy to Tomcat
    ProxyRequests Off
    ProxyPass / http://localhost:7778/website
    ProxyPassReverse / http://localhost:7778/website

    </VirtualHost>



What you may have to adjust




  • Log files directory

  • certificate files directory

  • LogLevel, remove debug mode once it works

  • Make sure required modules are loaded. apachectl -t will let you know if you are missing any.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333984%2fforward-apache-ssl-port-443-to-tomcat-http-port%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Two steps:



    1 Firts confirm your Tomcat is ok.



    Make sure you can connect to http://localhost:7778/website and get the expected response.



    Then, for proxy support modify your Connector:



    <Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />


    2 Fix your Apache configuration



    Here I assume:




    • when you try http://www.example.com you are redirected to https://www.example.com


    • when you try https://www.example.com you get the response from Tomcat



      Listen 80
      <VirtualHost *:80>
      ServerName www.example.com
      ServerAlias example.com

      CustomLog "logs/80_access.log" combined
      ErrorLog "logs/80_error.log"

      Redirect / https://www.example.com
      </VirtualHost>

      <VirtualHost *:443>
      ServerName www.example.com
      ServerAlias example.com

      # While debugging
      LogLevel debug
      CustomLog "logs/443_access.log" combined
      ErrorLog "logs/443_error.log"

      SSLEngine On
      SSLCertificateFile /path/to/certificate/file
      SSLCertificateKeyFile /path/to/key

      # Proxy to Tomcat
      ProxyRequests Off
      ProxyPass / http://localhost:7778/website
      ProxyPassReverse / http://localhost:7778/website

      </VirtualHost>



    What you may have to adjust




    • Log files directory

    • certificate files directory

    • LogLevel, remove debug mode once it works

    • Make sure required modules are loaded. apachectl -t will let you know if you are missing any.






    share|improve this answer




























      0














      Two steps:



      1 Firts confirm your Tomcat is ok.



      Make sure you can connect to http://localhost:7778/website and get the expected response.



      Then, for proxy support modify your Connector:



      <Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />


      2 Fix your Apache configuration



      Here I assume:




      • when you try http://www.example.com you are redirected to https://www.example.com


      • when you try https://www.example.com you get the response from Tomcat



        Listen 80
        <VirtualHost *:80>
        ServerName www.example.com
        ServerAlias example.com

        CustomLog "logs/80_access.log" combined
        ErrorLog "logs/80_error.log"

        Redirect / https://www.example.com
        </VirtualHost>

        <VirtualHost *:443>
        ServerName www.example.com
        ServerAlias example.com

        # While debugging
        LogLevel debug
        CustomLog "logs/443_access.log" combined
        ErrorLog "logs/443_error.log"

        SSLEngine On
        SSLCertificateFile /path/to/certificate/file
        SSLCertificateKeyFile /path/to/key

        # Proxy to Tomcat
        ProxyRequests Off
        ProxyPass / http://localhost:7778/website
        ProxyPassReverse / http://localhost:7778/website

        </VirtualHost>



      What you may have to adjust




      • Log files directory

      • certificate files directory

      • LogLevel, remove debug mode once it works

      • Make sure required modules are loaded. apachectl -t will let you know if you are missing any.






      share|improve this answer


























        0












        0








        0







        Two steps:



        1 Firts confirm your Tomcat is ok.



        Make sure you can connect to http://localhost:7778/website and get the expected response.



        Then, for proxy support modify your Connector:



        <Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />


        2 Fix your Apache configuration



        Here I assume:




        • when you try http://www.example.com you are redirected to https://www.example.com


        • when you try https://www.example.com you get the response from Tomcat



          Listen 80
          <VirtualHost *:80>
          ServerName www.example.com
          ServerAlias example.com

          CustomLog "logs/80_access.log" combined
          ErrorLog "logs/80_error.log"

          Redirect / https://www.example.com
          </VirtualHost>

          <VirtualHost *:443>
          ServerName www.example.com
          ServerAlias example.com

          # While debugging
          LogLevel debug
          CustomLog "logs/443_access.log" combined
          ErrorLog "logs/443_error.log"

          SSLEngine On
          SSLCertificateFile /path/to/certificate/file
          SSLCertificateKeyFile /path/to/key

          # Proxy to Tomcat
          ProxyRequests Off
          ProxyPass / http://localhost:7778/website
          ProxyPassReverse / http://localhost:7778/website

          </VirtualHost>



        What you may have to adjust




        • Log files directory

        • certificate files directory

        • LogLevel, remove debug mode once it works

        • Make sure required modules are loaded. apachectl -t will let you know if you are missing any.






        share|improve this answer













        Two steps:



        1 Firts confirm your Tomcat is ok.



        Make sure you can connect to http://localhost:7778/website and get the expected response.



        Then, for proxy support modify your Connector:



        <Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />


        2 Fix your Apache configuration



        Here I assume:




        • when you try http://www.example.com you are redirected to https://www.example.com


        • when you try https://www.example.com you get the response from Tomcat



          Listen 80
          <VirtualHost *:80>
          ServerName www.example.com
          ServerAlias example.com

          CustomLog "logs/80_access.log" combined
          ErrorLog "logs/80_error.log"

          Redirect / https://www.example.com
          </VirtualHost>

          <VirtualHost *:443>
          ServerName www.example.com
          ServerAlias example.com

          # While debugging
          LogLevel debug
          CustomLog "logs/443_access.log" combined
          ErrorLog "logs/443_error.log"

          SSLEngine On
          SSLCertificateFile /path/to/certificate/file
          SSLCertificateKeyFile /path/to/key

          # Proxy to Tomcat
          ProxyRequests Off
          ProxyPass / http://localhost:7778/website
          ProxyPassReverse / http://localhost:7778/website

          </VirtualHost>



        What you may have to adjust




        • Log files directory

        • certificate files directory

        • LogLevel, remove debug mode once it works

        • Make sure required modules are loaded. apachectl -t will let you know if you are missing any.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 14:36









        Nic3500Nic3500

        3,37781829




        3,37781829
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333984%2fforward-apache-ssl-port-443-to-tomcat-http-port%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues