Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Static site default configuration ignores 404.html, and always responds w/ 200 status + home page (index.html) content #5412

Closed
tcg opened this issue Mar 24, 2025 · 2 comments

Comments

@tcg
Copy link

tcg commented Mar 24, 2025

Error Message and Logs

There is no visible error. It appears to be configuration/behavior based.

Steps to Reproduce

  1. Build a static site with an index.html and a 404.html file.
  2. When configuring the resource, check the option for "static site"
  3. Deploy
  4. Visit a URL path that definitely does not exist. E.g., /some/path/that/does/not/exist

Example Repository URL

No response

Coolify Version

v4.0.0-beta.397

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04.2 LTS

Additional Information

This appears to be related to this line:

try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/ /index.html /index.htm =404;

I was able to find mention of this issue in a Discord thread, which appeared to have seen it resolved in a previous version: https://discord.com/channels/459365938081431553/1306307572814581862/1306309218432847976

It looks like this default config is assuming the static site is a SPA (based on the Git blame recent commit message).

I don't remember seeing any options in the Coolify UI to specify whether the static site should be considered a SPA / needs custom 404 page handling.

To overcome this issue for now, I'm using the "generate default config" option, and adjusting the relevant line.

e.g., this line:

try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/ /index.html /index.htm =404;

becomes

try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/  =404;

... which resolves the behavior.

@tcg tcg added 🐛 Bug Reported issues that need to be reproduced by the team. 🔍 Triage Issues that need assessment and prioritization. labels Mar 24, 2025
@tcg tcg changed the title [Bug]: Static site default configuration ignores 404.html, and always responds w/ 200 statis + home page (index.html) content [Bug]: Static site default configuration ignores 404.html, and always responds w/ 200 status + home page (index.html) content Mar 24, 2025
@tcg
Copy link
Author

tcg commented Mar 24, 2025

It seems like this may be a valid configuration for SPA's, but breaks if trying to "just host static content".

@andrasbacsai
Copy link
Member

I already use the new version that contains the fix (v399). You just need to regenerate the Nginx configuration.

@github-actions github-actions bot removed 🐛 Bug Reported issues that need to be reproduced by the team. 🔍 Triage Issues that need assessment and prioritization. labels Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants