Home > OS >  apache https is getting redirect to http
apache https is getting redirect to http

Time:12-01

I have configured https-vhosts.conf file in apache to point to non-standard port

ProxyRequests Off
ProxyPreserveHost On
Listen 8081
<VirtualHost *:8081>
  RequestHeader set X-Forwarded-Proto "https"                   ####this is needed for our app
  ServerName test.apa.com
  ProxyPass / http://10.1.1.5:8443
  ProxyPassReverse / http://10.1.1.5:8443
  SSLEngine on
  SSLCertificateFile /etc/ssl/certs/server.crt
  SSLCertificateKeyFile /etc/ssl/private/server.key
</VirtualHost>

However when I try to access url in chrome: enter image description here

Also, the url in address bar shows as http://test.apa.com:8081.However, when I change http to https and try to access...it works fine and browser shows https://test.apa.com:8081.

Please suggest on what the issue is with the configuration of virtual hosts?

CodePudding user response:

Listen 8081

Since you are using a non-standard port for HTTPS, you need to specify this in the Listen directive, otherwise it defaults to http. (https is only the default when using the standard 443 port.)

For example:

Listen 8081 https

Reference:

  • Related