"try_files $uri $uri/ =404;" -> causing 404 at domain.name/somestring?parameter= ?

Discussion in 'Nginx' started by postcd, Nov 2, 2022.

  1. #1
    Hello,

    while /etc/nginx/nginx.conf contains try_files line:

      location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://127.3.2.1:4242$request_uri;
    try_files $uri $uri/ =404;
    Code (markup):
    it cause app requests to end 404. I think that the app may be using:
    https://domain.name/somestring?parameter=alphanumericstring
    http://127.3.2.1:4242$request_uri
    Code (markup):
    somestring is really not a file that exist. Do you have idea how the try_files line should look like please? https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
    My only aim is to replace default 404 error pages by custom error message.

    The whole 404 configuration of mine the Nginx .conf is based on this tutorial.
    Thank you
     
    postcd, Nov 2, 2022 IP