Skip to content

HTTP Status Code 497 – HTTP Request Sent to HTTPS Port

HTTP Status Code 497 – HTTP Request Sent to HTTPS Port

The HTTP status code 497 is a non-standard status code used by certain web servers to indicate that a client has made an HTTP request to a port that is configured to accept HTTPS requests. This often occurs when a client mistakenly sends an unencrypted HTTP request to a server port that is expecting encrypted HTTPS traffic.

Example 1: Apache Web Server Configuration

Consider an Apache web server configured to listen for HTTPS traffic on port 443. If a client sends an HTTP request to this port, the server might respond with a 497 status code.


# Apache configuration (httpd.conf or similar)
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLProtocol all -SSLv3
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/key.pem

ErrorDocument 497 “HTTP Request Sent to HTTPS Port”
</VirtualHost>

In this example, the server is set up to handle HTTPS traffic on port 443. If an HTTP request is mistakenly sent to this port, the server responds with a 497 status code and a descriptive message.

Example 2: NGINX Server Configuration

NGINX can also utilize the 497 status code when configured to handle HTTPS traffic. The following configuration snippet shows how:


# NGINX configuration (nginx.conf or similar)
server {
listen 443 ssl;
server_name example.com;

ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;

error_page 497 =200 @error497;

location @error497 {
return 497 “HTTP Request Sent to HTTPS Port”;
}
}

In this configuration, NGINX listens for HTTPS traffic on port 443. If an HTTP request is received, it redirects to a custom error page with a 497 status code.

Example 3 Scenario

# Client sends a request example.
GET /example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 497 497 HTTP Request Sent to HTTPS Port
Date: Wed, 09 Oct 2024 23:09:32 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Description of the error for 497"
}

Example 4 Scenario

# Client sends another example request.
POST /another-example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 497 497 HTTP Request Sent to HTTPS Port
Date: Wed, 09 Oct 2024 23:09:32 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Detailed message for 497"
}

Summary

The 497 status code is a non-standard HTTP status code used primarily by Apache and NGINX servers to indicate that an HTTP request was mistakenly sent to an HTTPS port. This code helps in diagnosing configuration issues where HTTP and HTTPS traffic are misrouted. While not part of the official HTTP specification, it serves as a useful tool for web administrators to identify and correct such errors.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top