497 HTTP Request Sent to HTTPS Port
Nginx uses 497 internally; the client sees "400 Bad Request - The plain HTTP request was sent to HTTPS port". You can intercept it with error_page 497 to redirect to HTTPS.
An nginx-specific code for a plain-HTTP request that arrived on a port configured for HTTPS.
497 is an unofficial status code used by nginx. It is not part of the HTTP standard or the IANA registry.
What HTTP 497 HTTP Request Sent to HTTPS Port Means
An nginx-specific code for a plain-HTTP request that arrived on a port configured for HTTPS.
Nginx uses 497 internally; the client sees "400 Bad Request - The plain HTTP request was sent to HTTPS port". You can intercept it with error_page 497 to redirect to HTTPS.
Common Causes
- Visiting http://example.com:443 (HTTP scheme on the HTTPS port)
- A load balancer or reverse proxy forwarding plain HTTP to nginx's ssl port
- proxy_pass http://backend:443 instead of https://
- A listen directive with the ssl parameter on a port that receives HTTP traffic
How to Fix It (For Visitors)
- Change http:// to https:// in the address bar
- Remove an explicit :443 port from an http:// URL
- Update bookmarks that use the wrong scheme
How to Fix It (For Developers/Admins)
- Redirect HTTP to HTTPS on port 80 in a separate server block
- Catch the error and redirect: error_page 497 =301 https://$host$request_uri;
- Point upstream proxies at the correct scheme (https:// for TLS ports)
- If TLS terminates at the load balancer, let nginx listen without ssl on the forwarded port
Redirecting 497 to HTTPS
server {
listen 443 ssl;
server_name example.com;
# Plain HTTP that hits this port is redirected instead of getting a 400
error_page 497 =301 https://$host$request_uri;
...
}Nginx defines three related non-standard codes in its SSL module, all of which reach the client as 400 Bad Request but can be handled with error_page:
- 495 - an error occurred while verifying the client certificate
- 496 - the client did not present a required certificate
- 497 - a plain HTTP request was sent to the HTTPS port
See all nginx-specific codes.
Frequently Asked Questions
What does HTTP 497 HTTP Request Sent to HTTPS Port mean?
Nginx uses 497 internally; the client sees "400 Bad Request - The plain HTTP request was sent to HTTPS port". You can intercept it with error_page 497 to redirect to HTTPS. In short: An nginx-specific code for a plain-HTTP request that arrived on a port configured for HTTPS.
Is 497 an official HTTP status code?
No. 497 is not registered in the IANA HTTP Status Code Registry; it is specific to nginx. A client that receives an unrecognized status code treats it like the generic 400 code of its class.
How do I fix a 497 HTTP Request Sent to HTTPS Port error?
Redirect HTTP to HTTPS on port 80 in a separate server block. Catch the error and redirect: error_page 497 =301 https://$host$request_uri;. Point upstream proxies at the correct scheme (https:// for TLS ports).
Specification Status
497 HTTP Request Sent to HTTPS Port is not an official HTTP status code. It is not registered in the IANA HTTP Status Code Registry and is specific to nginx. Other servers and clients may not recognize it.
Source: nginx documentation: ngx_http_ssl_module error processing →