https works fine but *.com:443 gives a 400 error?

2019-06-05 19:26发布

问题:

I've got a site up (apache centos) that has no issues connecting over https but when I try to call a page with the 443 port defined ie example.com:443 I get a 400 error.

I've looked at the httpd.conf and listen 443 is uncommented.

Any ideas?

Thanks in advance

回答1:

The way http://www.example.com is the same as going for http://www.example.com:80

You will see that https://www.example.com equals https://www.example.com:443

What is probably happening to you is you are trying:

http://www.example.com:443 (that is, plain HTTP protocol, but over the 443 port).

Why is this a problem?

The web server expects SSL-encrypted data on the 443 port.

When you use http://www.example.com:443, you're telling your browser to speak plain HTTP to 443, an usually SSL-enabled server port.

The result is unpredictable. It ultimately depends on the server.

Most servers will either (1) kill the connection right off the bat or (2) just give back a HTTP 400 Bad request response, trying to let you know you did something wrong (the 4xx group of errors indicates client errors).