0

I tried installing cartbot SSL certificate in my ubuntu server by following the instruction on this https://github.com/antonputra/tutorials/tree/main/lessons/078

The URL where I am trying to secure is https://perfect.riwajchalise.com.np/. When I checked the network tab it seems as if there is some kind of connection to the server but the request is not served

Here is my Nginx configuration

server { root /var/www/html; index index.html; server_name perfect.riwajchalise.com.np; location / { try_files $uri $uri/ =404; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/perfect.riwajchalise.com.np/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/perfect.riwajchalise.com.np/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 { if ($host = perfect.riwajchalise.com.np) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; server_name perfect.riwajchalise.com.np; return 404; # managed by Certbot } 

Here is my nginx access log enter image description here

I am using Cloudflare as DNS. I think that shouldn't be an issue.

2
  • 2
    Something is generating a redirection loop. It's not the certbot configuration. Commented Aug 29, 2022 at 12:27
  • @GeraldSchneider thanks man! it was because I was using cloudflare as my DNS and stackoverflow.com/a/56387011/10003098 resolved my issue Commented Aug 29, 2022 at 12:42

1 Answer 1

2

You probably have a redirect loop because you configured cloudflare to connect over HTTP to your server.

Even when clients use HTTPS, Cloudflare does not and they get redirected:

1. Client ---> HTTP ----> Cloudflare CDN ----> HTTP ----> Your server | <------- Response: Redirect to HTTPS <- 2. Client ---> HTTPS ----> Cloudflare CDN ----> HTTP ----> Your server | <------- Response: Redirect to HTTPS <- 3. Client ---> HTTPS ----> Cloudflare CDN ----> HTTP ----> Your server | <------- Response: Redirect to HTTPS <- 

And that creates an Infinite redirect loop.

Configure CloudFlare to connect over HTTPS to your server and the redirect loop will go away.

And rather than redirecting your site visitors to HTTPS from your server, set up a Cloudflare page rule instead.

1
  • Excellent! I did that and it got resolved ssl/tsl>overview>full strict Commented Aug 29, 2022 at 12:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.