TL;DR
Problem: WordPress sites running on Nginx with HTTP/3 may experience broken redirects that malform to ?https:/// instead of the correct domain.
Root Cause: Nginx doesn’t properly pass the ?HTTP_HOST header to PHP through FastCGI when using HTTP/3, causing WordPress to generate invalid redirect URLs.
Quick Fix: Add this single line to your Nginx configuration:
fastcgi_param HTTP_HOST $host;
Test & Apply:
sudo nginx -t
sudo systemctl reload nginx.service
Result: WordPress will correctly generate redirects with proper hostnames across all HTTP protocols.
Introduction
I have been hosting my own nginx servers for WordPress sites for the past three years. I started doing this as a challenge set for me when I first joined the WooCommerce.com engineering team. The idea was, learn how to manage and run your own server for WordPress and have a broader understanding of how things work under the hood.
Since then, I’ve relied on one of my favourite tutorials. The Install WordPress on Ubuntu 24.04 tutorial by SpinupWP. It’s an amazing resource, I highly recommend it.
Recently, I migrated from the hand crafted files created by following the tutorial to the more modular and manageable version they offer on Github (see the repo).
Broken Locations and Redirects in PHP
I soon started to notice a weird bug – all of my pages worked fine, except the homepage…sometimes. It turns out that WordPress wasn’t correctly getting the hostname through FastCGI, leading to redirects being malformed to `https:///`.
The Solution
After some considerable sleuthing, and learning a bit more about HTTP/3, I discovered that the issue with with how the headers are formed when using HTTP/3. Essentially they’re not correctly being passed to PHP from Nginx.
The solution was nice and simple to implement fortunately – we directly set fastcgi_param HTTP_HOST $host; in our Nginx configs relating to FastCGI.
We’re ensuring this is sent with every request, over every protocol and therefore ensuring that PHP (and in my case WordPress) is correctly it to form redirects.
Instructions
If you’re using the Nginx configs by SpinupWP then you can implement this in your /global/fastcgi-params.conf file after the SERVER_NAME parameter.
As always, test your nginx config after a change:
sudo nginx -t
And then reload the Nginx service to apply the changes:
sudo systemctl reload nginx.service
Notes
I documented my findings in this issue on the SpinupWP repo. I also opened a pull request.
Special thanks to this incredible post from Pieter Bakker that helped me finally crack the issue!



