All services on the internet provide a variety of functionalities and features to enhance user experience. Due to ever-growing possibilities and new configuration options, I summarize general concepts and best practices on this page. The goal is to not only secure or extend existing systems, but also to give some hints to some not so well known functions and performance improvements. These configurations are not exhaustive and should be adapted to your specific needs and environment. It also does not only reflect public services, but also include recommended settings for internal domains and services in home and business networks.
I will not get into detail about every technology, but rather give an overview of key concepts and configurations with my personal recommendations. This should give you a solid foundation to build upon and customize according to your requirements.
I will use 2 of my own domains on this page for descriptions:
- bella.network - My main domain, authoritative for all services
- hync.io - A secondary domain, mostly referencing to the main domain
Web
DNS HTTPS & SVCB Records
These relatively new DNS records can help to speed up the connection establishment for HTTPS and HTTP/3 connections. By providing information about supported protocols and server hints, clients can optimize their connection setup process. Clients like Google Chrome, Microsoft Edge and Apple Safari resolve a domain name not only by A and AAAA records, but also check for HTTPS and SVCB records to get additional information about the server capabilities. If such a record is found and valid, the browser can skip some steps in the connection establishment process, connecting first using HTTPS leading to faster load times, improved performance and security.
An HTTPS record is similar to a SVCB record, but specifically for HTTPS services. It provides information about the supported protocols (like HTTP/2 and HTTP/3) and server hints (like IPv4 and IPv6 addresses).
|
|
In addition to the DNS record, you should also configure the web server to support HTTP/2 and HTTP/3 protocols. This typically involves enabling the respective modules or settings in your web server software (like Apache, Nginx, etc.). To provide the client with the necessary information to use HTTP/3, you need to configure the server to support the ALPN (Application-Layer Protocol Negotiation) extension in TLS and provide an HTTP header indicating support for an alternative protocol.
Note: A network change usually drops the record from the cache. Using the persist=1
tag, you can instruct the client to keep the record even after a network change.
|
|
Note: Some DNS filtering solutions like Cisco Umbrella do not support these records yet and will block them. Users of these services will not benefit from the optimizations.
A new addition is ECH (Encrypted Client Hello) which is a privacy enhancement for TLS 1.3 that encrypts the ClientHello message, preventing eavesdroppers from seeing sensitive information like the Server Name Indication (SNI). To enable ECH, you need to add a DNS record that contains the necessary configuration for ECH.
|
|
ECH isn’t widely supported yet, but major browsers like Google Chrome and Mozilla Firefox have started to implement it. To use ECH, both the client and server must support it. You also need to configure your web server to support ECH, which typically involves enabling the respective modules or settings in your web server software. As of now, a pull request to add ECH support to Nginx is still open: #840.
NEL (Network Error Logging)
Network Error Logging (NEL) is a mechanism that allows clients like browsers to report network errors encountered connecting to your webserver. By implementing NEL, you can gain insights into issues like failed resource loads, failed DNS resolution, connection problems, enabling you to detect and improve the reliability and performance of your web applications.
To configure NEL, you need to add a specific HTTP header to your server responses:
|
|
This header tells the browser to report network errors to a specified endpoint (in this case, “default”) and sets the maximum age for the reporting configuration.
Using the report_to
field, you can specify a group of endpoints to receive the reports. This allows for more flexible reporting configurations, such as sending reports to different endpoints based on the type of error or the resource being requested.
|
|
This solution is especially useful for mission-critical applications where uptime and performance are paramount. By proactively monitoring network errors, you can address issues at the moment they occur.
HSTS
HSTS (HTTP Strict Transport Security) is a security feature that helps to protect websites from man-in-the-middle attacks such as protocol downgrade attacks and cookie hijacking. It does this by enforcing the use of HTTPS and preventing the use of HTTP.
To implement HSTS, you need to add the following HTTP header to your server responses:
|
|
This header tells the browser to only connect to your site using HTTPS for the next 31536000 seconds (1 year) and to include all subdomains in this policy. The preload
directive indicates that you want your site to be included in the HSTS preload list maintained by major browsers. After adding the header, you can submit your domain to the HSTS preload list to ensure that browsers will always use HTTPS when connecting to your site.
Usually after a few months, the preload list which includes your domain will be included in browser updates, so that users will benefit from HSTS even on their first visit to your site. This is especially important for new users who have never visited your site before, as they will not have the HSTS policy cached in their browser.
Keep in mind that once you enable HSTS, it can be difficult to revert back to HTTP. If you need to disable HSTS for any reason, you will need to wait until the max-age
period has expired, your domain isn’t included in the preload list anymore and all browsers are updated which can take a long time.
CSP
CSP (Content Security Policy) is a security feature that helps to prevent cross-site scripting (XSS) attacks and other code injection attacks. It does this by allowing you to specify which sources of content are allowed to be loaded on your website. In a real-world scenario, you might use CSP to restrict the sources of scripts, styles, and other resources to only those that you trust. From my experience, CSP is not only one of the most effective ways to improve the security of your web applications, but also one of the most complex to implement correctly.
As a starting point, you can use the following CSP header:
|
|
Additional HTTPS Headers
Referrer-Policy restricts the amount of information sent in the Referer header when navigating from your site to another site. This can help to protect user privacy and prevent information leakage.
|
|
Permissions-Policy restricts the use of certain browser features and APIs, such as geolocation, microphone, and camera. This can help to prevent unauthorized access to sensitive information and improve user privacy.
|
|
X-Content-Type-Options prevents browsers from MIME-sniffing a response away from the declared content-type. This helps to reduce the risk of drive-by downloads and other types of attacks that rely on content-type misinterpretation.
|
|
Cross-Origin-Opener-Policy helps to isolate your website from other origins, preventing potential cross-origin attacks. This is especially important for sites that handle sensitive information or perform critical operations.
|
|
Cross-Origin-Resource-Policy helps to control how your resources can be shared with other origins. This is important for preventing unauthorized access to your resources and protecting user privacy.
|
|
Precompression of Static Assets
Precompressing static assets like HTML, CSS, and JavaScript files can significantly improve the performance of your website by reducing the amount of data that needs to be transferred over the network. This is especially important for users with slow internet connections or limited bandwidth. By precompressing these files, you can reduce the time it takes for them to load including the reduction of CPU usage on the server side, resulting in a faster and more responsive user experience. The most common compression algorithms used for this purpose are Gzip and Brotli, since Chrome 115 also supports Zstd compression.
To implement precompression, you can use tools like gzip
and brotli
to compress your static assets before serving them to users. You can also configure your web server to automatically serve the precompressed files when a client supports the corresponding compression algorithm.
For this task I use GitLab CI to automatically compress and upload the static assets to my web server whenever I update my website. This ensures that the precompressed files are always up-to-date and available for users. Nginx is then configured to serve the precompressed files when a client supports the corresponding compression algorithm.
Note: Zstd compression is not yet widely supported by all browsers and servers. Nginx does only support Zstd compression using a third-party module, which needs to be compiled into Nginx. Make sure to test the compatibility of Zstd with your target audience before implementing it.
Here is an example Nginx configuration to serve precompressed files:
The following Bash script can be used to precompress static assets using Gzip, Brotli, and Zstd:
|
|
Mail is one of the most common communication methods on the internet. However, it is also one of the most complex systems to set up and maintain. Below are some best practices and configurations to ensure a secure and efficient mail system, beginning with broad well-known settings and moving to more advanced options.
SPF, DKIM & DMARC
These three technologies work together to protect your domain from being used in email spoofing and phishing attacks.
SPF (Sender Policy Framework): This DNS record helps to specify which mail servers are allowed to send email on behalf of your domain. It helps to prevent spammers from sending messages that appear to come from your domain.
DKIM (DomainKeys Identified Mail): This technology adds a digital signature to your emails, which helps the receiving mail server verify that the email was indeed sent by your domain and has not been altered in transit.
DMARC (Domain-based Message Authentication, Reporting & Conformance): This policy allows you to specify what should happen if an email fails SPF or DKIM checks. It also provides a way for you to receive reports about email authentication issues.
Microsoft announced on 2025-04-02 that they will enforce SPF, DKIM and DMARC on all high volume senders, improving security and trust in email communication. Source
As long as your server supports signing of outgoing emails with DKIM, there are no downsides to implement these three technologies. However, be aware that incorrect configurations can lead to legitimate emails being marked as spam or rejected.
As I manage multiple domains, I implemented a centralized system to manage records within SPF. For example the following configuration is used by domains managed by me:
This allows me to configure SPF centrally for all domains from a single location (_spf.bella.network), making management easier and more efficient. I do not recommend to use SPF macros as some mail providers and filtering systems like Forcepoint do not respect RFC 7208 and will mark emails as spam where a private IP is used to signal a permitted sender. This results in legitimate emails being blocked or marked as spam.
For DMARC I use the following configuration, which rejects all emails that fail authentication and sends reports to a dedicated email address:
|
|
Note that the email address needs additional authorization if a different domain is used. If you want to use one centralized email address for reports, you can set up an additional DNS record like this:
|
|
This allows hync.io to use an @bella.network email address for DMARC reports.
DKIM is typically generated and provided by your mail server software or email service provider. The public key is then added to your DNS records as a TXT record. The exact configuration will depend on the software or service you are using. The only thing to consider is to choose a key length of at least 2048 bits RSA for security reasons. Unfortunately, ed25519 keys are not widely supported yet.
BIMI
BIMI (Brand Indicators for Message Identification) is an email specification that allows organizations to display their brand logo next to their authenticated emails. This not only helps with brand recognition but also increases trust with recipients.
To implement BIMI, you need to create a DNS record that points to the location of your brand logo (in SVG format). The logo must be a square image and meet specific requirements outlined in the BIMI specification. Due to the extremely high cost of a Verified Mark Certificate (VMC), I use the default option without VMC. In this case, some providers will not show the logo as there isn’t a verification that you are the trademark owner of the used logo. But still, some providers will show the logo, so it’s worth implementing it.
|
|
Note: For BIMI to work, you must have a valid DMARC policy in place with a policy of quarantine
or reject
. Additionally you need to provide the logo in SVG Tiny P/S format, which is a subset of SVG with specific requirements.
In addition to the DNS record, you can use Gravatar to assign your (company) logo to your email address. This can help increase the chances of your logo being displayed in email clients. For example I registered my noreply@bella.network/noreply@hync.io email address at Gravatar to show my logo in supporting email clients.
MTA-STS & TLS-RPT
MTA-STS (Mail Transfer Agent Strict Transport Security) is a mechanism that allows domain owners to declare their ability to receive secure (TLS) email. It helps to prevent man-in-the-middle attacks and ensures that emails are only delivered over secure connections. Servers supporting MTA-STS will check for the presence of a policy file on your web server and enforce TLS connections if the policy is found.
This is done by adding a DNS TXT record and hosting a policy file on your web server. Here is an example configuration:
|
|
The path https://mta-sts.bella.network/.well-known/mta-sts.txt
must contain the MTA-STS configuration as text file for the domain, for example in my case:
TLS-RPT (TLS Reporting) is a mechanism that allows domain owners to receive reports about the status of TLS connections to their mail servers. This can help identify misconfigurations or issues with email delivery.
|
|
DANE
DANE (DNS-based Authentication of Named Entities) is a protocol that allows the use of DNSSEC to associate X.509 certificates with domain names. This can be used to enhance the security of email communications by ensuring that emails are only sent to servers that have a valid or specific TLS certificate. NOTE: DNSSEC must be properly configured and active for your domain for DANE to work.
I strongly prefer DANE-TA (Trust anchor assertion) as instead of pointing to a specific certificate, it allows you to point to a trust anchor like Let’s Encrypt. This means that all certificates issued by Let’s Encrypt are automatically trusted. This has the benefit that you do not need to exchange the certificate hash on every renewal, but the downside is that any certificate issued by Let’s Encrypt for your hostname is trusted. (It basically restricts your mail certificates to a specific Certificate Authority)
You should only use DANE as an addition when you already have implemented everything else mentioned above. Be sure what you do as DANE configuration is tricky and can lead to email delivery issues if not done correctly.
The following list contains the, as of 2025-09-07, recommended TLSA records for DANE-TA when Let’s Encrypt is used. You need to adapt these if you are using another Certificate Authority.
|
|
DNS based Service Discovery
SRV Records are a type of DNS record that is used to identify the location of servers for specific services. They are commonly used for services like SIP, XMPP, and email. By using SRV records, you can make it easier for clients to discover and connect to your mail servers without needing to know the exact hostname or IP address.
|
|
DNSWL
A DNS-based whitelist (DNSWL) is a list of IP addresses or domains that are known to send legitimate email. By using a DNSWL, you can help ensure that emails from trusted sources are not mistakenly marked as spam. You can register your domain and IP address at DNSWL.org to improve email deliverability. It also provides you an overview of your domain’s reputation.
Besides DNSWL.org, there are other services like Google’s Postmaster Tools and Microsoft’s SNDS which provide insights into your email sending reputation and can help you identify and resolve deliverability issues.
Most mail providers use their own telemetry data to build internal whitelists and blacklists. Therefore, it’s important to maintain a good sending reputation by following best practices for email sending, such as using proper authentication methods (SPF, DKIM, DMARC), avoiding spammy content, and monitoring your sending patterns.
General Tips for Mail Servers
Always create a mailbox or alias for postmaster and abuse as required by RFC 2142. These mailboxes should be monitored regularly to ensure that any issues or complaints are addressed promptly.
DNS
DNS (Domain Name System) is a hierarchical system that translates human-readable domain names (like blog.bella.network) into IP addresses (like 37.120.178.36) that computers use to identify each other on the network. Proper DNS configuration is crucial for the functionality and security of your web services.
DDR
DDR (Discovery of Designated Resolvers) is a mechanism that allows clients to discover DNS resolvers that support specific features, such as DNS-over-HTTPS (DoH) or DNS-over-TLS (DoT). By implementing DDR, you can help ensure that clients can find and use secure DNS resolvers, improving privacy and security. To implement DDR, you need to add specific DNS records to primary nameserver of your local network. Here is an example configuration:
These records indicate that the DNS resolver for your domain supports both DoH and DoT, along with the necessary connection details.
DNScontrol
I use DNScontrol to manage DNS records for multiple domains from a single configuration file. This tool allows me to define DNS records in a structured way and then push updates to various DNS providers. Using simple JavaScript like configurations, I can create reusable components and templates for common record sets, making it easier to manage multiple domains with similar configurations. In connection with GitLab CI, I can automatically deploy changes to my DNS providers whenever I update the configuration file in my Git repository. Additionally using Scheduled Pipelines, I can regularly check and enforce that the DNS records are always in the desired state - making all DNS records easily auditable and version controlled.
Here is an example, non-complete configuration for DNScontrol which demonstrates the concepts mentioned above:
|
|
Conclusion
In this post, we’ve covered a range of configurations and best practices for web, mail, and DNS services. By implementing these recommendations, you can enhance the security, performance, and reliability of your online services. This list isn’t exhaustive, and you should always stay informed about new developments and best practices in these areas. Regularly review and update your configurations to ensure they remain effective and aligned with your specific needs and environment.
If you can recommend additional configurations, feel free to contact me so I can update and expand this post. Best practices and technologies are constantly evolving, and staying informed is key to maintaining a secure and efficient online presence.