497 HTTP Request Sent to HTTPS Port

HTTP response status code 497 HTTP Request Sent to HTTPS Port is an unofficial client error specific to nginx. The server returns this code when a plain HTTP request arrives on the HTTPS port.

Usage

The 497 HTTP Request Sent to HTTPS Port status code indicates the HTTP request is valid, but the server refuses to process because the request was sent in plain text to the HTTPS port. This is related to 400. Resolving this error requires either sending the request as HTTPS to the same port, or sending the plain HTTP request to the correct HTTP port.

SEO impact

Search engines like Google do not index a URL with 497 HTTP Request Sent to HTTPS Port response status. URLs previously indexed with this code are removed from search results.

Example

A client sends a plain HTTP request to port 443, which expects HTTPS traffic. The nginx server responds with 497 HTTP Request Sent to HTTPS Port.

Request

GET /login HTTP/1.1
Host: www.example.re

Response

HTTP/1.1 497
Content-Type: text/html
Content-Length: 205

<html>
  <head>
    <title>HTTP Request Sent to HTTPS Port</title>
  </head>
  <body>
   <p>The plain HTTP request was sent to the
   HTTPS port. Use HTTPS to access this
   resource.</p>
  </body>
</html>

How to fix

The most direct fix uses the nginx error_page 497 directive to automatically redirect plain HTTP requests arriving on the HTTPS port to the correct protocol:

server {
    listen 443 ssl;
    server_name www.example.re;

    ssl_certificate /etc/nginx/ssl/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/key.pem;

    error_page 497 =301
      https://$host:$server_port$request_uri;
}

This catches the 497 internally and sends a 301 redirect to the client, preserving the original port number and request URI.

For standard port 443, a separate server block listening on port 80 handles the common case of users typing http:// in the browser:

server {
    listen 80;
    server_name www.example.re;
    return 301 https://$host$request_uri;
}

Update hard-coded http:// URLs in the application codebase. Configuration files, environment variables, database records, and API endpoint definitions referencing http:// cause clients to connect on the wrong protocol repeatedly.

Ensure the application generates HTTPS URLs for all links, form actions, and redirects. Relative URLs avoid protocol mismatches entirely.

Check upstream proxy or load balancer settings. A reverse proxy terminating TLS and forwarding plain HTTP to nginx on port 443 triggers this error if nginx expects TLS on the same port. Configure the upstream to forward using the same protocol nginx expects.

Takeaway

The 497 HTTP Request Sent to HTTPS Port status code is a nginx client error sent when the client sends a plain HTTP request to the HTTPS port.

See also

Last updated: March 5, 2026