Codeberg/pages-server
26
387
Fork
You've already forked pages-server
54

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
Copy link

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
Copy link

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.

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
Copy link

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?

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
Copy link

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 :'(

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
Copy link

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.

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
Copy link

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 ...

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 pagesifo.appendTrailingSlash&&!strings.HasSuffix(ctx.Path(),"/"){ctx.Redirect(ctx.Path()+"/",http.StatusTemporaryRedirect)returntrue}

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
Copy link

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/`

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
Copy link

Wow, that's really confusing.

Wow, that's really confusing.
Contributor
Copy link

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 Branch/Tag specified
main
no-not-allow-for-new-users
pages
pages-custom-domain-update
ci_user-local-acme-service
feat/redis-caching
fix/memory-problem
v6.4
v6.3
v6.2.1
v6.2
v6.1
v6.0
v5.1
v5.0
v4.6.3
v4.6.2
v4.6.1
v4.6
v4.5
v4.4
v4.3
v4.2
v4.1
v4.0
v3.2.1
v3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v3.1
v3.0a
v3.0
v2.5b
v2.5a
v2.5
v2.4
v2.3
v2.2
v2.1
v2.0
v1.0_php
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
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
Reference in a new issue
Codeberg/pages-server
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?