I want to be able, if the request tries to access <host>/.well-known/acme-challenge/ to serve the matching file if found.
If the request is something else, I want to redirect it to https://
server { listen 8080; server_name my_example.com; location /.well-known/acme-challenge/ { alias /var/www/encrypt/.well-known/acme-challenge/; try_files $uri =404; } return 301 https://$server_name$request_uri; } Problem is when accessing to my_example.com/.well-known/acme-challenge/12345 which exist in alias path, i'm still redirected to https:// and the browser doesn't download the file.
How can I just serve the file and not apply the redirection in this case ?
Thanks