Docker & React 404 Refresh Error


So I have done the React & Docker courses.

I have an React app running in Docker.

I have one issue. When the user refreshes the page, they are getting a 404 error.

I have included this in the nginx.conf file:

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;

    try_files $uri $uri/ /index.html?$args;

I have this in my Docker file:

FROM nginx

COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/build /usr/share/nginx/html

Something still is not correct.

What am I missing?

Thanks in advance.