I recently added my site to Cloudflare and all of my subdomains like portainer and my file server are working however my main domain that points to my Nginx server returns "error 400 bad request The plain HTTP request was sent to HTTPS port"

I am using caddy to reverse proxy with this config

georgenet.uk:443 {
tls internal

georgenet.uk:80 {
tls internal

and my Nginx server is using this config

server {
    listen 81;
    listen [::]:81;
    server_name georgenet.uk www.georgenet.uk;
    return 302 https://$server_name$request_uri;

server {

    # SSL configuration

    listen 444 ssl http2;
    listen [::]:444 ssl http2;
    ssl_certificate         /etc/ssl/cert.pem;
    ssl_certificate_key     /etc/ssl/key.pem;

    server_name georgenet.uk www.georgenet.uk;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;

    location / {
            try_files $uri $uri/ =404;

I have already tried ssl off and ssl on like many solutions have suggested however I keep getting this error, is it something to do with caddy redirecting the default ports to 81 and 444 as this was working before I started using Cloudflare.

1 Answer 1


Ports 81 and 444 are not among the ports supported by Cloudflare. To get Cloudflare to work you need to choose from among the following supported ports:

HTTP ports supported by Cloudflare

  • 80
  • 8080
  • 8880
  • 2052
  • 2082
  • 2086
  • 2095

HTTPS ports supported by Cloudflare

  • 443
  • 2053
  • 2083
  • 2087
  • 2096
  • 8443
  • the ports 81 and 444 are only used inside my network, the reverse proxy (caddy) translates them from 81 and 444 to 80 and 443 when traffic is sent back to and from cloudflare. So cloudflare should only see traffic on ports 80 and 443. Aug 24, 2022 at 18:31
  • Can you include your reverse proxy configuration. My guess is something's wrong with that then. Aug 24, 2022 at 22:57
  • The first section of code in my post is the caddy configuration for the website, this method was working for when I was using Lets encrypt before I changed to cloudflare. The same config is used for my other services such as portainer and filebrowser where I point the 80 and 443 port to the docker containers. Aug 24, 2022 at 23:09
  • Why do you have tls internal on the port 80 configuration in caddy? That could be part of the problem. Aug 25, 2022 at 0:07
  • I used this method to configure my caddy link Aug 25, 2022 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.