diff --git a/.dockerignore b/.dockerignore index eaeb446..bc06aa3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,5 +4,6 @@ ## Except the following files and directories !/cmd !/internal +!/l10n !/templates !/go.* diff --git a/internal/http/handlers/error_page/handler.go b/internal/http/handlers/error_page/handler.go index ba628b7..2122cc2 100644 --- a/internal/http/handlers/error_page/handler.go +++ b/internal/http/handlers/error_page/handler.go @@ -85,7 +85,7 @@ func New(cfg *config.Config, log *logger.Logger) http.Handler { //nolint:funlen, tplProps.ServicePort = r.Header.Get("X-Service-Port") // (ingress-nginx) port number of the Service backing the backend tplProps.RequestID = r.Header.Get("X-Request-Id") // (ingress-nginx) unique ID that identifies the request - same as for backend service tplProps.ForwardedFor = r.Header.Get("X-Forwarded-For") // the value of the `X-Forwarded-For` header - tplProps.Host = r.Header.Get("Host") // the value of the `Host` header + tplProps.Host = r.Host // the value of the `Host` header } // try to find the code message and description in the config and if not - use the standard status text or fallback @@ -121,6 +121,7 @@ func New(cfg *config.Config, log *logger.Logger) http.Handler { //nolint:funlen, if tpl, found := cfg.Templates.Get(templateName); found { if content, err := template.Render(tpl, tplProps); err != nil { + // TODO: add GZIP compression for the HTML content support write(w, log, fmt.Sprintf( "\nFailed to render the HTML template %s: %s", templateName, diff --git a/l10n/l10n.js b/l10n/l10n.js index eaa04d7..2fffbe9 100644 --- a/l10n/l10n.js +++ b/l10n/l10n.js @@ -1,3 +1,4 @@ +// the very first line should be kept as a comment to avoid unexpected commenting when embedding the script into the HTML Object.defineProperty(window, 'l10n', { value: new function () { const tokenSerializationRe = /[^a-z0-9]/g; @@ -13,7 +14,7 @@ Object.defineProperty(window, 'l10n', { /** * Each **key** should be in English (this is the default/main locale). * - * @link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes list + * @link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes language codes list (column `Set 1` or `ISO 639-1:2002`) * * @type {Map>} */ diff --git a/templates/ghost.html b/templates/ghost.html index f93d278..22113ae 100644 --- a/templates/ghost.html +++ b/templates/ghost.html @@ -1,118 +1,247 @@ - - - + + {{ code }}: {{ message }} - - - - + + + + + + + -
-
- - - - - - - - - - - - -

- - - -

-

Error {{ code }}

-

{{ description }}

- {{ if show_details }} -
- - {{- if host }} - - - {{ end -}} - {{- if original_uri }} - - - {{ end -}} - {{- if forwarded_for }} - - - {{ end -}} - {{- if namespace }} - - - {{ end -}} - {{- if ingress_name }} - - - {{ end -}} - {{- if service_name }} - - - {{ end -}} - {{- if service_port }} - - - {{ end -}} - {{- if request_id }} - - - {{ end -}} - - - - -
Host{{ host }}
Original URI{{ original_uri }}
Forwarded for{{ forwarded_for }}
Namespace{{ namespace }}
Ingress name{{ ingress_name }}
Service name{{ service_name }}
Service port{{ service_port }}
Request ID{{ request_id }}
Timestamp{{ now.Unix }}
-
- {{ end }} -
-
- +
+
+ + + + + + + + +

+ + + +

+ +

Error {{ code }}

+

{{ description }}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Host{{ host }}
Original URI{{ original_uri }}
Forwarded for{{ forwarded_for }}
Namespace{{ namespace }}
Ingress name{{ ingress_name }}
Service name{{ service_name }}
Service port{{ service_port }}
Request ID{{ request_id }}
Timestamp{{ now.Unix }}
+ +
+
+ + + -