Score:0

Redirecting from http to https with Nginx causes Google Search Console to report an issue

in flag

I have a website built (in plain HTML) using letsencrypt certificates. The Nginx config is redirecting traffic from http to https. I submitted this website to Google's Search Console, and they are sending me emails that "Page with redirect" issue detected and "must remove to enable the best experience" (?).

This is my nginx configuration.

server {
        root /var/www/example/html;
        index index.html index.htm index.nginx-debian.html;
        server_name example.gr www.example.gr;
        location / {
                try_files $uri $uri/ =404;
        }

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.gr-0001/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.gr-0001/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    listen 80;
    listen [::]:80;

    server_name example.gr;

    if ($host = example.gr) {
        return 301 https://$host$request_uri;  # <-- this line might be causing the issue
    } # managed by Certbot

    return 404; # managed by Certbot
}

What am I doing wrong?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.