You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
330 B

  1. error_page 418 = @nonwww;
  2. set $nonwww "";
  3. if ( $http_host ~* "^www\.") {
  4. set $nonwww "${nonwww}0";
  5. }
  6. if ( $nonwww ~* "^0+$" ) {
  7. return 418;
  8. }
  9. # TODO: map need moved to conf.d
  10. map $host $tld {
  11. default $host;
  12. '~^www\.(?<domain>.*)$' $domain;
  13. }
  14. location @nonwww {
  15. rewrite ^ https://$tld$request_uri permanent;
  16. }