I have a location block in my nginx server, if i access using https://example.com/login/ display my alias folder value correctly, but if i use as follow: https://example.com/login/?param1=value1, i have a Error 400 bad request

location ~ /login/ {
    alias /var/www/app_one/dist/;
    try_files $uri$args $uri$args/ /var/www/app_one/dist/index.html;
  • What are you trying to achieve with $uri$args and $uri$args/? – Richard Smith Oct 9 at 9:27

try_files is used to refer to physical files on the filesystem. With your configuration, when requesting /login/?param1=value1, nginx tries to find file /var/www/app_one/dist/login/param1=value1.

Depending on the actual contents of param1 and value1, nginx might respond with 400 Bad request, because some characters are not allowed when accessing files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.