CF is randomly loosing port number in HTTP header "host"

I'm not sure if this is the right place to report a bug.

Cloudflare is randomly sending wrong "host" HTTP header to end server (loosing port number). Once per every approx. 15-20 requests.

More details:
My HTTPS server is listening on port 8443.
Traffic is routed through Cloudflare.
Here is an example URL: https://check-cf.vezha.com:8443/testCrawl
Normally my webserver is connected to port 8443 and HTTP header "host" is filled with check-cf.vezha.com:8443.
But once per approximately 15-20 GET requests, my server is getting request with incorrect "host" header: check-cf.vezha.com. The port number is missing.

The mentioned webserver is configured specially to show the problem for you.
It is using the following trivial Nginx config for the domain check-cf.vezha.com:

server {
  server_name check-cf.vezha.com;
  listen      0.0.0.0:8443 ssl http2;
  root        /var/www/html;

  include     commonSSL.conf;

  location    /
  {
    add_header Content-Type text/plain;
    return 200 'healthy; http_host: $http_host;';
  }
}


Here is how I automate executing HTTP requests:

set -eu

while true
do
  curl https://check-cf.vezha.com:8443/testCrawl
  echo ""
done


Here is a typical Bash script output:

c:\temp\crawl_vezha_for_error>bash crawl.sh
healthy; http_host: check-cf.vezha.com:8443;
healthy; http_host: check-cf.vezha.com:8443;
healthy; http_host: check-cf.vezha.com;
healthy; http_host: check-cf.vezha.com:8443;
healthy; http_host: check-cf.vezha.com:8443;
healthy; http_host: check-cf.vezha.com;
healthy; http_host: check-cf.vezha.com:8443;


Here is an example of HTTP response headers for the case when port number was lost by CF:
< HTTP/2 200
< date: Tue, 04 Feb 2025 04:07:00 GMT
< content-type: text/plain
< content-length: 39
< server: cloudflare
< cf-cache-status: DYNAMIC
< cf-ray: 90c7ca93d9fcbbde-WAW
< alt-svc: h3=":8443"; ma=86400
<
healthy; http_host: check-cf.vezha.com;* Connection #0 to host check-cf.vezha.com left intact
Was this page helpful?