CSS styling breaks when 404 page is served on nginx server #6685
-
Contextincase you need to check on the production site. https://docs.itsjusttriz.com/ Bug descriptionIm having an issue with getting the default 404 page to render? If the url path is not valid, its just breaking the page altogether instead of rendering the builtin 404 error. Yet it works in dev?! Related linksReproductionIm not actually sure if there's any specific steps ive done differently other than creating my mkdocs project, and then importing things from material & using them?! However, the repo is here if you wanna take a look. - https://github.com/itsjusttriz/ijtdev-docs Steps to reproduce
BrowserNo response Before submitting
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
Thanks for reporting. Yes, yes, yes, we need a reproduction, because without it, we can't investigate. You might want to check why assets are not loaded. I'm converting this to a discussion, so others can help you. It is, very likely, not a bug. |
Beta Was this translation helpful? Give feedback.
-
nah im using ubuntu on my server and have nginx managing the routing. I just tried adding
to my nginx.conf and reloaded and im getting same issue. |
Beta Was this translation helpful? Give feedback.
-
Answer: I re-configured my nginx config as follows: server {
server_name docs.itsjusttriz.com;
root /path/to/site/root; # Adjust based on your actual setup
index index.html;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
location = /404.html {
root /path/to/site/root; # Adjust based on your actual setup
internal;
}
} This is relying on my Keep in mind, the problematic view may still be cached and served. You'll need to check on it every now and again. |
Beta Was this translation helpful? Give feedback.
Answer: I re-configured my nginx config as follows:
This is relying on my
404.html
being in the same directory as myindex.html
Keep in mind, the problematic view may still be cached and served. You'll need to check on it every now and again.