17 March 2025

Nginx Refuses Dark Mode Support for Error Pages

Nginx has rejected support for Dark Mode in error pages, preferring to keep a minimalist approach and leave customization to system administrators.

NGINX-Dark-Mode-Error

Introduction

In recent years, Dark Mode has become an essential feature for many internet users. Browsers, operating systems, and many applications have implemented this feature to improve the viewing experience and reduce eye strain. However, the web server Nginx has recently decided to refuse a proposal to add dark mode support to its default error pages.

The Context: The Pull Request and the Proposed Feature

Last week a new one was opened Pull request (PR) in the official Nginx repository on GitHub to add native support for dark mode in error pages. The proposed method was extremely simple: add the meta tag color-scheme with the value light dark in standard Nginx error pages. This would allow modern browsers to automatically adapt the page's rendering based on user preferences.

The change was small but effective, as browsers that supported this feature could display error pages with a dark background when the user enabled dark mode in their operating system or browser.

Nginx Rejection and Motivation

Despite the simplicity and effectiveness of the proposal, the Nginx development team decided to refuse the PR, arguing that:

  1. Nginx default error pages should be kept simple – The goal of standard error pages is to provide only essential information, without any unnecessary elements.
  2. The additional meta tag is considered superfluous – While this is a small addition in terms of code, the Nginx development team believes it is not a necessary change.
  3. System administrators can customize error pages – If a server admin wants an error page with dark mode support, he can simply use the directive error_page of Nginx to serve a custom HTML page with the desired support.

As a result, the proposal was closed without being accepted into the official NGINX codebase.

The Role of Dark Mode in the Modern Web

Implementing Dark Mode has become one of the best practices for web development. It is not only an aesthetic improvement, but has several practical benefits:

  • Reduction of eye strain – Especially in low-light environments, using a dark background reduces the overall brightness of the screen and helps prevent eye strain.
  • Greater energy efficiency – On devices with OLED displays, dark mode consumes less power than a white background, increasing battery life.
  • User preferences – Many users set Dark Mode as the default in their operating system or browser, expecting visual consistency across all websites and applications.

Considering these benefits, many online services and software have adopted this feature to improve the user experience. The rejection of Nginx may seem like a step backwards in this direction.

Why Did Nginx Reject the Change?

Analyzing Nginx's decision, we can identify some reasons behind the refusal:

1. Minimalist Philosophy

Nginx is known for its efficiency and simplicity. Its standard error pages are deliberately basic, with no advanced styling or external dependencies. Adding a meta tag It might seem like an insignificant detail, but it is part of a broader logic of keeping the code minimal.

2. “Customizable by Admins” approach

Nginx already provides a way to customize error pages via the directive error_page. An administrator can serve a completely customized HTML page, including not only dark mode support, but also any other graphical and functional enhancements.

3. Maintain Backward Compatibility

Even if adding the tag color-scheme It does not break compatibility with any browser or system, the Nginx team seems to be very careful to avoid any unnecessary changes.

How to Implement Dark Mode in Custom Error Pages

If a system administrator wants to support Dark Mode in error pages, they can do so by customizing Nginx error pages.

Here is an example of a custom error page with dark mode support:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="color-scheme" content="light dark">
    <title>404 Not Found</title>
    <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cstyle%3E%0A%20%20%20%20%20%20%20%20body%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20font-family%3A%20Arial%2C%20sans-serif%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20text-align%3A%20center%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20padding%3A%2050px%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%3C%2Fstyle%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;style&gt;" title="&lt;style&gt;" />
</head>
<body>
    <h1>404 Not Found</h1>
    <p>The requested resource could not be found on this server.</p>
</body>
</html>

 

This setup replaces the standard error page with a custom version that supports Dark Mode.

Conclusions

Nginx's decision to reject Dark Mode in default error pages has generated some discussion in the community. On the one hand, the change would be simple and improve the user experience for those using dark mode. On the other hand, Nginx is staying true to its minimalist philosophy and leaves customization to system administrators.

Those who want to have error pages that respect Dark Mode can easily implement them using the method described above. For now, however, users who encounter a 404 page served by NGINX will have to resign themselves to the classic white background, at least until it is customized by the server operator.

Link to the original pull request: GitHub – Nginx PR 567

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.

0256569681

Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.

DISCLAIMER, Legal Notes and Copyright. RedHat, Inc. holds the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of the AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. holds the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds holds the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt; Oracle Corporation holds the rights to Oracle®, MySQL®, MyRocks®, VirtualBox®, and ZFS®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; PostgreSQL® is a registered trademark of PostgreSQL Global Development Group; SQLite® is a registered trademark of Hipp, Wyrick & Company, Inc.; KeyDB® is a registered trademark of EQ Alpha Technology Ltd.; Typesense® is a registered trademark of Typesense Inc.; REDIS® is a registered trademark of Redis Labs Ltd; F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB; HAProxy® is a registered trademark of HAProxy Technologies LLC; Traefik® is a registered trademark of Traefik Labs; Envoy® is a registered trademark of CNCF; Adobe Inc. owns the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited; Automattic Inc. holds the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert owns the rights to Drupal®; Shopify® is a registered trademark of Shopify Inc.; BigCommerce® is a registered trademark of BigCommerce Pty. Ltd.; TYPO3® is a registered trademark of the TYPO3 Association; Ghost® is a registered trademark of the Ghost Foundation; Amazon Web Services, Inc. owns the rights to AWS® and Amazon SES®; Google LLC owns the rights to Google Cloud™, Chrome™, and Google Kubernetes Engine™; Alibaba Cloud® is a registered trademark of Alibaba Group Holding Limited; DigitalOcean® is a registered trademark of DigitalOcean, LLC; Linode® is a registered trademark of Linode, LLC; Vultr® is a registered trademark of The Constant Company, LLC; Akamai® is a registered trademark of Akamai Technologies, Inc.; Fastly® is a registered trademark of Fastly, Inc.; Let's Encrypt® is a registered trademark of the Internet Security Research Group; Microsoft Corporation owns the rights to Microsoft®, Azure®, Windows®, Office®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®; Apache® is a registered trademark of The Apache Software Foundation; Apache Tomcat® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group; Docker® is a registered trademark of Docker, Inc.; Kubernetes® is a registered trademark of The Linux Foundation; OpenShift® is a registered trademark of Red Hat, Inc.; Podman® is a registered trademark of Red Hat, Inc.; Proxmox® is a registered trademark of Proxmox Server Solutions GmbH; VMware® is a registered trademark of Broadcom Inc.; CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV; Grafana® is a registered trademark of Grafana Labs; Prometheus® is a registered trademark of The Linux Foundation; Zabbix® is a registered trademark of Zabbix LLC; Datadog® is a registered trademark of Datadog, Inc.; Ceph® is a registered trademark of Red Hat, Inc.; MinIO® is a registered trademark of MinIO, Inc.; Mailgun® is a registered trademark of Mailgun Technologies, Inc.; SendGrid® is a registered trademark of Twilio Inc.; Postmark® is a registered trademark of ActiveCampaign, LLC; cPanel®, LLC owns the rights to cPanel®; Plesk® is a registered trademark of Plesk International GmbH; Hetzner® is a registered trademark of Hetzner Online GmbH; OVHcloud® is a registered trademark of OVH Groupe SAS; Terraform® is a registered trademark of HashiCorp, Inc.; Ansible® is a registered trademark of Red Hat, Inc.; cURL® is a registered trademark of Daniel Stenberg; Facebook®, Inc. owns the rights to Facebook®, Messenger® and Instagram®. This site is not affiliated with, sponsored by, or otherwise associated with any of the above-mentioned entities and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. All other trademarks mentioned are the property of their respective registrants.

JUST A MOMENT !

Have you ever wondered if your hosting sucks?

Find out now if your hosting provider is hurting you with a slow website worthy of 1990! Instant results.

Close the CTA
Back to top