map $request_uri $new_uri { # fix published urls /wrong-path "https://${host}/correct-path"; # force https for others default "https://${host}${request_uri}"; } server { listen [::]:80 default_server; listen 80 default_server; server_name _; return 301 $new_uri; }