0

I have configured my DNS service (bind9) on an Ubuntu server that has a public IP address. I have added in /etc/bind/db.mydomain.com (my domain zone) as an "A" record (with a public IP address) of a machine: machine1.mydomain.com A 153.203.52.35.

I can ping machine1.mydomain.com from the internet. I can also SSH to it without issue. The problem is that any attempt to reach the website hosted on this machine with a browser (http://machine1.mydomain.com) is automatically redirected to https (https://machine1.mydomain.com) and this gives the following error: "An error occurred during a connection to machine1.mydomain.com. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG".

Telnet to port 80 of the machine works fine:

$ telnet machine1.mydomain.com 80
Trying 153.203.52.35...
Connected to machine1.mydomain.com.
Escape character is '^]'.

My http server (nginx) configuration is configured with port 80 and no https redirection is configured. When I try to reach the website using the IP address of the server (http://153.203.52.35) the webpage displays with no issue and no redirection to https is done.

I am sure that the https redirection in my case has nothing to do with my nginx (see below my enabled site in nginx)

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root   /var/www/mydomain.com;
        index index.php index.html index.htm ;
        server_name mydomain.com;
        location / {
                try_files $uri $uri/ =404;
        }
                location ~ \.php$ {
        include snippets/fastcgi-php.conf;
       fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param   SCRIPT_FILENAME  /var/www/mydomain.com$fastcgi_script_name;
}
}

I spent 2 days trying to figure out what is happening without success. Http redirection is usually done at http server level not in the DNS server. I am confused.

Any remark or advice that solve this issue will save me time and money.

Burgi
  • 6,768

1 Answers1

0

Since the website could be shown with curl command, the only remaining thing was to clear the DNS and cache from the browser using the following post: How to stop an automatic redirect from “http://” to “https://” in Chrome. The problem is solved.