HTTP Request Sent to HTTPS Port
Production Risk
Low — usually a misconfiguration issue. Use the error_page directive to redirect gracefully.
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.
- 1A client is configured to use HTTP instead of HTTPS and is connecting on port 443.
- 2A misconfigured reverse proxy is forwarding plain HTTP traffic to an HTTPS upstream.
- 3A developer is testing with curl and forgot to use https:// in the URL.
A misconfigured client or proxy sends a plain HTTP request to port 443.
# 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.
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.
# 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.
✕ Do not serve plain HTTP on port 443
Port 443 is the HTTPS standard port; mixing protocols causes client confusion.
nginx-specific. The error_page 497 directive can be used to redirect to HTTPS.
nginx SSL module documentation
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#497 ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev