HTTPfy

497 HTTP Request Sent to HTTPS Port

nginx internal: a plain HTTP request arrived on a TLS port; the client receives 400.

497 at a glance

Code
497
Name
HTTP Request Sent to HTTPS Port
Class
4xx Client error
Status
Non-standard used by nginx
Documented by
nginx
Client receives
A 400 Bad Request page; 497 appears only in nginx logs and error_page.
Cacheable by default
Not applicable: this code is never sent to the client.

What 497 means

nginx uses 497 when a plain-HTTP request is sent to a port configured with listen ... ssl. The client receives 400 "The plain HTTP request was sent to HTTPS port". A common trick is error_page 497 =301 https://$host$request_uri; to redirect such requests to HTTPS on the same port.

What typically causes a 497

  • Typing http://example.com:443 or using http:// with a non-standard HTTPS port.
  • A load balancer or proxy forwarding HTTP to nginx's TLS port (e.g. ALB target group with protocol HTTP on port 443).
  • Health checks configured with the wrong protocol.

Fix it on the server

  • Point plain-HTTP listeners and health checks at the HTTP port, or redirect with error_page 497.

Fix it as a client or visitor

  • Use https:// for that port.

Example response

HTTP/1.1 400 Bad Request
Server: nginx
Content-Type: text/html

<center>The plain HTTP request was sent to HTTPS port</center>

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.