[PATCH] HTTP Special Page backgrounds
Nova
nova at novalinium.com
Wed Sep 19 15:41:23 UTC 2018
TZAG,
I've run into a compatability issue between Nginx error/special response
pages and customized font color and background color in
user stylesheets. I use white on black as my default color scheme, and
since the Nginx special pages specify bgcolor but not color
(font color), this leads to a "blank" white page (with a hr on it). The
attached patch presented for review removes Nginx bgcolor
on special pages, since this is not necessary to render them as intended
without interfering with accessibility settings.
Best,
Nova
-------------- next part --------------
# HG changeset patch
# User Nova DasSarma <nova at novalinium.com>
# Date 1537367207 18000
# Wed Sep 19 09:26:47 2018 -0500
# Node ID f359ea07f1d61c284fb54706c881120c3e4628c0
# Parent 87d2ea860f380dc8418c97c0163412f53c2d008e
HTTP Special Responses: removed bgcolor attribute on body.
bgcolor overrides compatibility settings in browsers and leads to undesirable behavior when the default font color is set to white in the browser, since font-color is not also overridden.
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -60,7 +60,7 @@ static u_char ngx_http_msie_refresh_tail
static char ngx_http_error_301_page[] =
"<html>" CRLF
"<head><title>301 Moved Permanently</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>301 Moved Permanently</h1></center>" CRLF
;
@@ -68,7 +68,7 @@ static char ngx_http_error_301_page[] =
static char ngx_http_error_302_page[] =
"<html>" CRLF
"<head><title>302 Found</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>302 Found</h1></center>" CRLF
;
@@ -76,7 +76,7 @@ static char ngx_http_error_302_page[] =
static char ngx_http_error_303_page[] =
"<html>" CRLF
"<head><title>303 See Other</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>303 See Other</h1></center>" CRLF
;
@@ -84,7 +84,7 @@ static char ngx_http_error_303_page[] =
static char ngx_http_error_307_page[] =
"<html>" CRLF
"<head><title>307 Temporary Redirect</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>307 Temporary Redirect</h1></center>" CRLF
;
@@ -92,7 +92,7 @@ static char ngx_http_error_307_page[] =
static char ngx_http_error_308_page[] =
"<html>" CRLF
"<head><title>308 Permanent Redirect</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>308 Permanent Redirect</h1></center>" CRLF
;
@@ -100,7 +100,7 @@ static char ngx_http_error_308_page[] =
static char ngx_http_error_400_page[] =
"<html>" CRLF
"<head><title>400 Bad Request</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>400 Bad Request</h1></center>" CRLF
;
@@ -108,7 +108,7 @@ static char ngx_http_error_400_page[] =
static char ngx_http_error_401_page[] =
"<html>" CRLF
"<head><title>401 Authorization Required</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>401 Authorization Required</h1></center>" CRLF
;
@@ -116,7 +116,7 @@ static char ngx_http_error_401_page[] =
static char ngx_http_error_402_page[] =
"<html>" CRLF
"<head><title>402 Payment Required</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>402 Payment Required</h1></center>" CRLF
;
@@ -124,7 +124,7 @@ static char ngx_http_error_402_page[] =
static char ngx_http_error_403_page[] =
"<html>" CRLF
"<head><title>403 Forbidden</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>403 Forbidden</h1></center>" CRLF
;
@@ -132,7 +132,7 @@ static char ngx_http_error_403_page[] =
static char ngx_http_error_404_page[] =
"<html>" CRLF
"<head><title>404 Not Found</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>404 Not Found</h1></center>" CRLF
;
@@ -140,7 +140,7 @@ static char ngx_http_error_404_page[] =
static char ngx_http_error_405_page[] =
"<html>" CRLF
"<head><title>405 Not Allowed</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>405 Not Allowed</h1></center>" CRLF
;
@@ -148,7 +148,7 @@ static char ngx_http_error_405_page[] =
static char ngx_http_error_406_page[] =
"<html>" CRLF
"<head><title>406 Not Acceptable</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>406 Not Acceptable</h1></center>" CRLF
;
@@ -156,7 +156,7 @@ static char ngx_http_error_406_page[] =
static char ngx_http_error_408_page[] =
"<html>" CRLF
"<head><title>408 Request Time-out</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>408 Request Time-out</h1></center>" CRLF
;
@@ -164,7 +164,7 @@ static char ngx_http_error_408_page[] =
static char ngx_http_error_409_page[] =
"<html>" CRLF
"<head><title>409 Conflict</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>409 Conflict</h1></center>" CRLF
;
@@ -172,7 +172,7 @@ static char ngx_http_error_409_page[] =
static char ngx_http_error_410_page[] =
"<html>" CRLF
"<head><title>410 Gone</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>410 Gone</h1></center>" CRLF
;
@@ -180,7 +180,7 @@ static char ngx_http_error_410_page[] =
static char ngx_http_error_411_page[] =
"<html>" CRLF
"<head><title>411 Length Required</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>411 Length Required</h1></center>" CRLF
;
@@ -188,7 +188,7 @@ static char ngx_http_error_411_page[] =
static char ngx_http_error_412_page[] =
"<html>" CRLF
"<head><title>412 Precondition Failed</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>412 Precondition Failed</h1></center>" CRLF
;
@@ -196,7 +196,7 @@ static char ngx_http_error_412_page[] =
static char ngx_http_error_413_page[] =
"<html>" CRLF
"<head><title>413 Request Entity Too Large</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>413 Request Entity Too Large</h1></center>" CRLF
;
@@ -204,7 +204,7 @@ static char ngx_http_error_413_page[] =
static char ngx_http_error_414_page[] =
"<html>" CRLF
"<head><title>414 Request-URI Too Large</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>414 Request-URI Too Large</h1></center>" CRLF
;
@@ -212,7 +212,7 @@ static char ngx_http_error_414_page[] =
static char ngx_http_error_415_page[] =
"<html>" CRLF
"<head><title>415 Unsupported Media Type</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>415 Unsupported Media Type</h1></center>" CRLF
;
@@ -220,7 +220,7 @@ static char ngx_http_error_415_page[] =
static char ngx_http_error_416_page[] =
"<html>" CRLF
"<head><title>416 Requested Range Not Satisfiable</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>416 Requested Range Not Satisfiable</h1></center>" CRLF
;
@@ -228,7 +228,7 @@ static char ngx_http_error_416_page[] =
static char ngx_http_error_421_page[] =
"<html>" CRLF
"<head><title>421 Misdirected Request</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>421 Misdirected Request</h1></center>" CRLF
;
@@ -236,7 +236,7 @@ static char ngx_http_error_421_page[] =
static char ngx_http_error_429_page[] =
"<html>" CRLF
"<head><title>429 Too Many Requests</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>429 Too Many Requests</h1></center>" CRLF
;
@@ -245,7 +245,7 @@ static char ngx_http_error_494_page[] =
"<html>" CRLF
"<head><title>400 Request Header Or Cookie Too Large</title></head>"
CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>400 Bad Request</h1></center>" CRLF
"<center>Request Header Or Cookie Too Large</center>" CRLF
;
@@ -255,7 +255,7 @@ static char ngx_http_error_495_page[] =
"<html>" CRLF
"<head><title>400 The SSL certificate error</title></head>"
CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>400 Bad Request</h1></center>" CRLF
"<center>The SSL certificate error</center>" CRLF
;
@@ -265,7 +265,7 @@ static char ngx_http_error_496_page[] =
"<html>" CRLF
"<head><title>400 No required SSL certificate was sent</title></head>"
CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>400 Bad Request</h1></center>" CRLF
"<center>No required SSL certificate was sent</center>" CRLF
;
@@ -275,7 +275,7 @@ static char ngx_http_error_497_page[] =
"<html>" CRLF
"<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>"
CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>400 Bad Request</h1></center>" CRLF
"<center>The plain HTTP request was sent to HTTPS port</center>" CRLF
;
@@ -284,7 +284,7 @@ CRLF
static char ngx_http_error_500_page[] =
"<html>" CRLF
"<head><title>500 Internal Server Error</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>500 Internal Server Error</h1></center>" CRLF
;
@@ -292,7 +292,7 @@ static char ngx_http_error_500_page[] =
static char ngx_http_error_501_page[] =
"<html>" CRLF
"<head><title>501 Not Implemented</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>501 Not Implemented</h1></center>" CRLF
;
@@ -300,7 +300,7 @@ static char ngx_http_error_501_page[] =
static char ngx_http_error_502_page[] =
"<html>" CRLF
"<head><title>502 Bad Gateway</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>502 Bad Gateway</h1></center>" CRLF
;
@@ -308,7 +308,7 @@ static char ngx_http_error_502_page[] =
static char ngx_http_error_503_page[] =
"<html>" CRLF
"<head><title>503 Service Temporarily Unavailable</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>503 Service Temporarily Unavailable</h1></center>" CRLF
;
@@ -316,7 +316,7 @@ static char ngx_http_error_503_page[] =
static char ngx_http_error_504_page[] =
"<html>" CRLF
"<head><title>504 Gateway Time-out</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>504 Gateway Time-out</h1></center>" CRLF
;
@@ -324,7 +324,7 @@ static char ngx_http_error_504_page[] =
static char ngx_http_error_505_page[] =
"<html>" CRLF
"<head><title>505 HTTP Version Not Supported</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>505 HTTP Version Not Supported</h1></center>" CRLF
;
@@ -332,7 +332,7 @@ static char ngx_http_error_505_page[] =
static char ngx_http_error_507_page[] =
"<html>" CRLF
"<head><title>507 Insufficient Storage</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
+"<body>" CRLF
"<center><h1>507 Insufficient Storage</h1></center>" CRLF
;
More information about the nginx-devel
mailing list