497
HTTPERRORNotable4xx Client Error (Unofficial)HIGH confidence

HTTP Request Sent to HTTPS Port

Production Risk

Low — usually a misconfiguration issue. Use the error_page directive to redirect gracefully.

What this means

497 HTTP Request Sent to HTTPS Port is an nginx extension returned when a plain HTTP request is received on an SSL/TLS-secured port. nginx detects the unencrypted request on the HTTPS port and rejects it.

Why it happens
  1. 1A client is configured to use HTTP instead of HTTPS and is connecting on port 443.
  2. 2A misconfigured reverse proxy is forwarding plain HTTP traffic to an HTTPS upstream.
  3. 3A developer is testing with curl and forgot to use https:// in the URL.
How to reproduce

A misconfigured client or proxy sends a plain HTTP request to port 443.

trigger — this will error
trigger — this will error
# Sending plain HTTP to port 443
curl http://example.com:443/api

expected output

HTTP/1.1 497 HTTP Request Sent to HTTPS Port

Fix 1

Use HTTPS in the request URL

WHEN The client is using the wrong scheme.

Use HTTPS in the request URL
curl https://example.com/api
# or configure the client to use https://

Why this works

Ensures the client initiates a TLS handshake before sending the HTTP request.

Fix 2

Add nginx redirect for HTTP→HTTPS

WHEN You want to handle the mistake gracefully.

Add nginx redirect for HTTP→HTTPS
# nginx.conf
server {
    listen 443 ssl;
    # Detect plain HTTP and redirect
    error_page 497 https://$host$request_uri;
}

Why this works

Redirects plain HTTP requests received on port 443 to the correct HTTPS URL.

What not to do

Do not serve plain HTTP on port 443

Port 443 is the HTTPS standard port; mixing protocols causes client confusion.

Version notes
nginx

nginx-specific. The error_page 497 directive can be used to redirect to HTTPS.

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All HTTP errors