Hi all.. First of all thanks for giving us that nice product!
Why use weird if's in nginx config, when you can not!? Event nginx creator Igor Sysoev have said in one of his video, if you you can not use if statements, dont use them..
So instead of
if ($host = www.jonsson.am) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = jonsson.am) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name jonsson.am www.jonsson.am;
return 404; # managed by Certbot
use
listen 80 ;
listen [::]:80 ;
server_name jonsson.am www.jonsson.am;
return 301 https://$host$request_uri; # managed by Certbot
and please, try to do something with those comments, because of them at the end of line, we can't properly indent entire file with vim command gg=G
@ vim - How do I fix the indentation of an entire file in Vi? - Stack Overflow
github issue: Improve certbot config generator · Issue #9705 · certbot/certbot · GitHub
Thanks!
3 Likes
Ouuchh, sorry, i thought there was no Issue's tab.. My bad, I will post issue in github project, thanks!
4 Likes
schoen
May 31, 2023, 10:47pm
4
Thanks for filing your issue at
opened 08:57PM - 31 May 23 UTC
Hi all.. First of all thanks for giving us that nice product!
Why use weird i… f's statements in nginx config, when you can not!? Event nginx creator Igor Sysoev have said in one of his video, if you you can not use if statements, dont use them..
So instead of
```
server {
if ($host = www.moew.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = moew.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name moew.com www.moew.com;
return 404; # managed by Certbot
}
```
use (much sexier & cleaner)
```
server {
listen 80;
listen [::]:80 ;
server_name moew.com www.moew.com;
return 301 https://$host$request_uri; # managed by Certbot
}
```
and also remove multiple (1+) blank lines and try to do something with those comments (# managed by Certbot), because of them at the end of line, we (maybe only I) can't properly indent entire file with vim command gg=G @ [vim - How do I fix the indentation of an entire file in Vi? - Stack Overflow](https://stackoverflow.com/questions/506075/how-do-i-fix-the-indentation-of-an-entire-file-in-vi)
## Certbot's behavior differed from what I expected because:
When using your if statement's, i got TOO_MANY_REDIRECTS error
Hopefully the current Certbot developers will comment on it. (I left a comment with my recollection about one reason that might have motivated the existing behavior.)
4 Likes
system
Closed
June 30, 2023, 10:47pm
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.