# \[Astro 5.7.2\] Custom 404 page not being rendered in production

**URL:** <https://community.fly.io/t/astro-5-7-2-custom-404-page-not-being-rendered-in-production/24791>\
**Category:** JavaScript\
**Tags:** troubleshooting, login-only\
**Created:** [May 8, 2025, 9:22am UTC](https://community.fly.io/t/astro-5-7-2-custom-404-page-not-being-rendered-in-production/24791 "2025-05-08T09:22:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexLekso](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@AlexLekso](https://community.fly.io/u/AlexLekso)\
**Post date:** [May 8, 2025, 9:22am UTC](https://community.fly.io/t/astro-5-7-2-custom-404-page-not-being-rendered-in-production/24791/1 "2025-05-08T09:22:09Z")

</div>

Hi all,

I have an AstroJS project, ZINiN-2024, that runs on version 5.7.2.

Locally, and also in my staging environment, the custom 404 page works as expected. When I visit the /404 or /non-existent-page, it shows the custom 404 page. But when it is on the production environment, I see the default browser 404 page (See image).

 ![Screenshot 2025-05-08 at 11.02.10](https://global.discourse-cdn.com/fly1/original/3X/a/e/ae2b1250c96cd9dcda5d5b354a79f9a4e79b5922.png)

When directly visiting the /404.html however, I do get to see my custom 404 page again. I have created my 404 page in src/pages/404.astro.

When checking the network tab, I get the following errors when visiting a page that does not exists (See images).  
 ![Screenshot 2025-05-08 at 11.05.13](https://global.discourse-cdn.com/fly1/optimized/3X/7/6/76dbf661e0d9962bd1a5835d714265bf7d0687a2_2_690x16.png)

 ![Screenshot 2025-05-08 at 11.05.46](https://global.discourse-cdn.com/fly1/original/3X/7/0/70e36366434ede839b2ffb62662823b64c410086.png)

From what I have analyzed, it seems that on any fly environment the custom 404 page does not seem to want to render. I have tested it on both the [test environment](https://zinin-2024.fly.dev/does-not-exist) of ZINiN and the [live environment](https://www.zinin.com/does-not-exist).

Could this be a case where I need to configure Fly in a specific way in order for me to make the /404 work? What could be causing this?

I have also tried to use Astro’s redirect and rewrite functions in order for me to go to /404, but that does not seem to do anything.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [May 15, 2025, 1:43pm UTC](https://community.fly.io/t/astro-5-7-2-custom-404-page-not-being-rendered-in-production/24791/3 "2025-05-15T13:43:40Z")

</div>

Closed on May 15, 2025, 1:43pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
