Internal pages blank#164

Closed
opened 2023-01-24 03:48:37 +01:00 by jimafisk · 16 comments

I have my own pages-server running and it does a great job serving up the /index.html page content. However if I try going to an internal page (like /about.html or /about/index.html), it's returning empty <head> and <body> tags so the page is completely blank. It does appear to be routing correctly though, because if I go to a page that doesn't exist I get the "Page not found" error instead of the blank page. Is this a common misconfiguration you've seen before? Thank you!

I have my own pages-server running and it does a great job serving up the `/index.html` page content. However if I try going to an internal page (like `/about.html` or `/about/index.html`), it's returning empty `<head>` and `<body>` tags so the page is completely blank. It does appear to be routing correctly though, because if I go to a page that doesn't exist I get the "Page not found" error instead of the blank page. Is this a common misconfiguration you've seen before? Thank you!
Contributor

I can confirm this problem. However, I also run into it on pages with index.html.
I get no errors in the console, even with DEBUG set to true.

Edit: removing the `key-database.pogreb seems to solve the problem temporarily.

I can confirm this problem. However, I also run into it on pages with index.html. I get no errors in the console, even with DEBUG set to true. Edit: removing the `key-database.pogreb seems to solve the problem temporarily.
Owner

Is the data modified, or maybe corrupted? (Like, just missing the rest of the page)? I think I've seen something like this before.

Is the data modified, or maybe corrupted? (Like, just missing the rest of the page)? I think I've seen something like this before.
Author

If I systemctl restart pages-server the first hard refresh on any of these internal pages will work. However, any subsequent refresh results in the blank page (besides the homepage which works consistently).

If I `systemctl restart pages-server` the first hard refresh on any of these internal pages will work. However, any subsequent refresh results in the blank page (besides the homepage which works consistently).
Member

Sounds like the cache is not actually returning the data that it thinks it has.

Sounds like the cache is not actually returning the data that it thinks it has.

Is there a way to disable the cache?

Is there a way to disable the cache?
Author

Potentially related issue: #142

Are there debugging steps we could take to pinpoint what is causing this? Thanks!

Potentially related issue: https://codeberg.org/Codeberg/pages-server/issues/142 Are there debugging steps we could take to pinpoint what is causing this? Thanks!
Owner

Ah yes, thank you for the link. Right, we had issues of incomplete content when directly accessing the Gitea server without a reverse proxy.

We decided against digging deeper and just reverting the configuration change :'(

Ah yes, thank you for the link. Right, we had issues of incomplete content when directly accessing the Gitea server without a reverse proxy. We decided against digging deeper and just reverting the configuration change :'(
Author

Is the configuration change something in your environment, or in the project that has been updated? I'm running the latest release (v4.5) but still seem to be encountering the issue. I'm not clear if pages-server is doing the reverse proxying or if you're using a separate service for that. Thank you!

Is the configuration change something in your environment, or in the project that has been updated? I'm running the latest release ([v4.5](https://codeberg.org/Codeberg/pages-server/releases/tag/v4.5)) but still seem to be encountering the issue. I'm not clear if pages-server is doing the reverse proxying or if you're using a separate service for that. Thank you!
Owner

If you specify your server address, you could either use a public facing URL (e.g. https://codeberg.org/) or an internal one (e.g. http://gitea-production.lxc.local:3000/). We use the former. When we tried the latter for a more direct connection, we had this issue.

If you specify your server address, you could either use a public facing URL (e.g. https://codeberg.org/) or an internal one (e.g. http://gitea-production.lxc.local:3000/). We use the former. When we tried the latter for a more direct connection, we had this issue.
Author

I'm setting GITEA_ROOT to a fully qualified domain name (public facing URL). Is there another place I should specifying this?

I'm setting `GITEA_ROOT` to a fully qualified domain name (public facing URL). Is there another place I should specifying this?
Owner

I think the next debugging step would be to use a traffic analyzer like wireshark to see what is actually going on and where a request might stop working ...

I think the next debugging step would be to use a traffic analyzer like wireshark to see what is actually going on and where a request might stop working ...
Author

I've pinpointed this problem to ~ line 165 in server/upstream/upstream.go:

// Append trailing slash if missing (for index files), and redirect to fix filenames in general // o.appendTrailingSlash is only true when looking for index pages if o.appendTrailingSlash && !strings.HasSuffix(ctx.Path(), "/") { ctx.Redirect(ctx.Path()+"/", http.StatusTemporaryRedirect) return true } 

Commenting this block out completely allows internal pages in format of mysite.com/about/index.html to load correctly (mysite.com/about.html still won't work).

I've pinpointed this problem to ~ line 165 in `server/upstream/upstream.go`: ```go // Append trailing slash if missing (for index files), and redirect to fix filenames in general // o.appendTrailingSlash is only true when looking for index pages if o.appendTrailingSlash && !strings.HasSuffix(ctx.Path(), "/") { ctx.Redirect(ctx.Path()+"/", http.StatusTemporaryRedirect) return true } ``` Commenting this block out completely allows internal pages in format of `mysite.com/about/index.html` to load correctly (`mysite.com/about.html` still won't work).
Member

were you getting a blank page for /about/index.html before? you were supposed to get a redirect to /about/ which would serve up the content of index.html.

that line of code isn't even responsible for that redirect, it's just supposed to redirect you from /about to /about/

were you getting a blank page for `/about/index.html` before? you were supposed to get a redirect to `/about/` which would serve up the content of index.html. that line of code isn't even responsible for that redirect, it's just supposed to redirect you from `/about` to `/about/`
Author

Yeah it's really weird, not the fix I was expecting. It's actually just the return that's causing the issue (not the whole block). My site hydrates to an SPA and the clientside router uses URLs without the trailing slash. So when that conditional is evaluating to true and returning at this point it must be preventing a critical block further down from running?

Yes going to /about/index.html or /about/ would be blank (unless going there right after a systemctl restart pages-server and the first page loaded like this would continue to work 🤷). My homepage /index.html always worked.

Yeah it's really weird, not the fix I was expecting. It's actually just the `return` that's causing the issue (not the whole block). My site hydrates to an SPA and the clientside router uses URLs without the trailing slash. So when that conditional is evaluating to true and returning at this point it must be preventing a critical block further down from running? Yes going to `/about/index.html` or `/about/` would be blank (unless going there right after a `systemctl restart pages-server` and the first page loaded like this would continue to work 🤷). My homepage `/index.html` always worked.
Member

Wow, that's really confusing.

Wow, that's really confusing.
Contributor

An alle pages-server admins & devs, i have created an dedicated room: https://matrix.to/#/!VTsiUcuAxMmLxesQRa:obermui.de?via=obermui.de

@dorianim, @jimafisk, ...

An alle pages-server admins & devs, i have created an dedicated room: https://matrix.to/#/!VTsiUcuAxMmLxesQRa:obermui.de?via=obermui.de @dorianim, @jimafisk, ...
Sign in to join this conversation.
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/pages-server#164
No description provided.