my nginx version is 1.16.1. this is my try_filse configure:
location / {
root /home/nginx/html/dist/;
try_files $uri $uri/ /index.html;
}
location = /index.html {
root /home/nginx/html/dist/;
}
as what said on nginx.org, if $uri and $uri failed. will redirect to /index.html. pay attention to my root configure and i do not configure index config, so the index default value will be index.html.
i trace the source code and debug them step by step, if redirection triggered .this branch must be tirggerd. enter link description here but tf->names is /index.html, never be null.
so the reindrect function will be called. enter link description here
but always goto to this code , 403 forbiden. because open file failed in the ngx_http_static_modue. enter link description here
if tf->names is /index.html, this record never be null, the branch and redirect never be triggerd, maybe a bug.
has sovled, misunderstanding of try_files. i have asked same question on nginx slack community. get correct answer. anywhy thank you anyone even that guy vote -1.