Mohammed Alselini
Mohammed Alselini

Reputation: 1

Misdirected Request Error with Multiple SSL Virtual Hosts in NGROK

I'm using Apache with multiple SSL/TLS virtual hosts and encountering a "Misdirected Request" error when accessing the second virtualhost site through NGROK. The error only resolves when the problematic virtual host configuration is moved to the top of the Apache configuration file above the sandbox one. Whichever virtualhost config comes first works fine when starting it up with ngrok using this temrinal command; ngrok start --config ngrok.yml sandbox mysql. And I'm able to access both sites through their virtualhost url's.

my ngrok config set up:

version: 2
authtoken: 2fpIT7pthDC5nwG1O9oqn0WqNif_3ewsP7aQQpVo41z1bwRPq
tunnels:
  sandbox:
    proto: http
    addr: 443
    host_header: "local.sandbox.hivehost.co.uk"  # This should match the Server$
  willowtree:
    proto: http
    addr: 443
    host_header: "local.willowtreeprimary.org"  # This should match the ServerN$
  mysql:
    proto: tcp
    addr: 3306

My virtualhosts Apache configuration file set up:

<VirtualHost *:80>
       DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/"
       ServerName localhost
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/sandbox/sandbox.hivehost.co.uk/public_html/"
    ServerName local.sandbox.hivehost.co.uk
    <Directory "/Applications/XAMPP/xamppfiles/htdocs/sandbox/sandbox.hivehost.co.uk/public_html/">
        Require all granted
        AllowOverride All
        Options Indexes FollowSymLinks
    </Directory>

  SSLEngine on
SSLCertificateFile "/Applications/XAMPP/xamppfiles/etc/sandbox-crt/server.crt"
SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/etc/sandbox-crt/server.key"
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/willowtree/willowtreeprimary.org/public_html/"
    ServerName local.willowtreeprimary.org
    <Directory "/Applications/XAMPP/xamppfiles/htdocs/willowtree/willowtreeprimary.org/public_html/">
        Require all granted
        AllowOverride All
        Options Indexes FollowSymLinks
    </Directory>
    SSLEngine on
   SSLCertificateFile "/Applications/XAMPP/xamppfiles/etc/willowtree-crt/server.crt"
SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/etc/willowtree-crt/server.key"
</VirtualHost>

Whichever virtualhost config I place first works fine when starting it up with ngrok using this temrinal command; ngrok start --config ngrok.yml sandbox mysql. but the second one will return the error: Misdirected Request The client needs a new connection for this request as the requested host name does not match the Server Name Indication (SNI) in use for this connection.

Upvotes: 0

Views: 73

Answers (0)

Related Questions