简体   繁体   中英

Facebook not able to scrape my secured url (Nginx)

I have a Node.js app running on a Ubuntu server, with an SSL configured Nginx setup using Let's Encrypt.

My Nginx config file looks like this:

server {

server_name www.example.be example.be;
location / {
        proxy_pass http://localhost:3485;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.be/fullchain.pem; # managed by C$
ssl_certificate_key /etc/letsencrypt/live/example.be/privkey.pem; # managed by$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
   if ($host = www.example.be) {
      return 301 https://$host$request_uri;
   } # managed by Certbot


   if ($host = example.be) {
      return 301 https://$host$request_uri;
   } # managed by Certbot


   listen 80;
   server_name www.example.be example.be;
   return 404; # managed by Certbot
}

Without SSL, Facebook is perfectly able to scrape my url, but when I activate SSL and then submit it in the Facebook Sharing Debugger, I get following errors:

Could Not Follow Redirect : URL requested a HTTP redirect, but it could not be followed.

Circular Redirect : We could not resolve the canonical URL because the redirect path contained a cycle.

Redirect Path

Input URL -> https://www.example.be

301 HTTP Redirect -> https://www.example.be

Also, I have exactly the same problem with Google's PageSpeed insights. The error I'm getting there is "Attempting to load page reached the limit of 10 redirects"

Thanks for any suggestions!

将https强制重定向到此

if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM