From 3176cfbc47f09a338db2a930db86b12cdd10586e Mon Sep 17 00:00:00 2001 From: Gao Hanxiang Date: Fri, 23 Jul 2021 06:27:16 -0400 Subject: [PATCH] fix: 400 page appears when using http protocol to access When using http protocol to access, nginx will respond with 400 and report "400 The plain HTTP request was sent to HTTPS port". The reason is that http 497 error[1] appeared in nginx, so 497 error was redirected to https protocol. [1] https://github.com/nginx/nginx/blob/56f53316837271a8cbb1d99f638e28d268a00d45/src/http/ngx_http_special_response.c#L274 Change-Id: I01c35318dd5d219dbb31e6a89bdc05d2a4db7804 --- libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 b/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 index b1abf3f..8156a96 100644 --- a/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 +++ b/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 @@ -78,6 +78,8 @@ http { server_name _; + error_page 497 https://$http_host$request_uri; + location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404.