0

i run a single aws ec2 instance (apache2) behind an elb which gives me a free ssl cert from amazon. I have redirected all port 80 traffic to 443 in config and everything runs smoothly.

But, when i log into phpmyadmin using username and password the url is like

https://www.example.com:80/phpmyadmin/index.php?token=d130b4290f74c1b0a97de101d173d16e

and browser shows this error enter image description here

If i go into the tab and edit out the :80 then it redirects me to the phpmyadmin area and it works fine. why is this happening? how to fix this?

1

Your attempting to connect to https://www.example.com:80/path/ which obviously won't work because your browser will attempt to connect using SSL but then your server is returning non-SSL information on the port 80.

Web Servers do not detect the use of HTTP/HTTPS in the address bar, your browser translates that into the correct port and data transfer type. If you are using ports 80, 8080, 443 then there should never be any need to add that port information to the URL address, your browser does that part for you.

You can't not connect to HTTPS:// using port 80 unless you change the 443 setup to 80 in the virtual host SSL but if you do this then the HTTP:// will no longer work, since browsers will attempt to connect to a unencrypted connection and then get encrypted data and the in fail.

In short... this really isn't an issue, you're creating the issue by using a the wrong URL format. Connect correctly and you won't ever get this protocol issue.

E.g

  • Correct https://www.example.com/phpmyadmin/index.php?token=example
  • Correct but not required: https://www.example.com:443/phpmyadmin/index.php?token=example
  • Will not work https://www.example.com:80/phpmyadmin/index.php?token=example
  • Correct http://www.example.com/phpmyadmin/index.php?token=example
  • Correct but not required: http://www.example.com:80/phpmyadmin/index.php?token=example
  • Will not work http://www.example.com:443/phpmyadmin/index.php?token=example
  • the question was how can i make phpmyadmin default to port 443 or none when logging in. I am automatically being redirected to example.com:80/phpmyadmin/index.php?token=example – nandu kk May 11 '18 at 4:50
  • You have to add phpmyadmin twice within the virtual host, one as 443, one as 80... you can't redirect solely having 443. Use htaccess to do the redirect. – Simon Hayter May 11 '18 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.