HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

497 HTTP Request Sent to HTTPS Port

Fault: Client / configuration
Unofficial · nginx
TL;DR

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.

Specification note

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

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

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:

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 →

See all unofficial HTTP status codes →