HTTP Request Sent to HTTPS Port
ActiveHTTP 497 HTTP Request Sent to HTTPS Port is an Nginx-proprietary status code returned when a plain HTTP request arrives on a port configured for HTTPS. The client is connecting to port 443 (or another TLS port) without using TLS. Nginx returns 497 to signal 'you need to use https://' rather than silently failing or returning a generic error.
Description
497 allows Nginx to redirect clients that incorrectly send HTTP to an HTTPS port. With error_page 497 = https://$host$request_uri, Nginx can transparently redirect these clients to the correct HTTPS URL. This commonly happens when clients have a misconfigured port in their URL, or when a service is migrating from HTTP to HTTPS and some clients haven't updated their configuration.
Examples
server {
listen 443 ssl;
error_page 497 https://$host$request_uri;
# Redirects: http://example.com:443/path → https://example.com/path
}Edge Cases
- •497 only fires in Nginx. Other servers typically close the connection or return a TLS handshake error before any HTTP response is possible.
- •A properly configured TLS server should not be in this situation – port 80 should redirect and port 443 should only accept TLS.
When You'll See This
- →Client misconfigured to use port 443 with http:// scheme
- →API client updated URL host but not scheme
- →Load balancer misconfiguration sending plain HTTP to HTTPS backend
Implementation References
| Language | Constant |
|---|---|
| Nginx | 497 (Nginx proprietary) |
History
Nginx-specific code for HTTP requests arriving on HTTPS-only ports. Enables clean HTTP→HTTPS redirect logic.
Related Status Codes
Related Headers
FAQ
Can I use 497 in my application code?
No – 497 is generated by Nginx at the TLS termination layer before your application receives the request. Your application code cannot emit 497.