DEV Community

ayumi
ayumi

Posted on

404 page in Production doesn't work #gatsby

I created a 404 page in src/pages404.js`.
I expect 404 page to be there in production but I just got 404 Not Found error (nginx).
When it's local environment, wrong URL redirect to 404 page for development.

Why 404 page I created is not showed in production??

Top comments (2)

Collapse
 
aaayumi profile image
ayumi

It was fixed by docker configuration.

  location /
  {
    try_files $uri $uri/index.html =404;
    error_page 404 /404.html;
  }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
fullstackchris profile image
Chris Frewin

This isn't a docker configuration, but an NGINX configuration. :)