pages-server/server
Hoernschen a6e9510c07 FIX blank internal pages (#164) (#292)
Hello 👋

since it affected my deployment of the pages server I started to look into the problem of the blank pages and think I found a solution for it:

1. There is no check if the file response is empty, neither in cache retrieval nor in writing of a cache. Also the provided method for checking for empty responses had a bug.
2. I identified the redirect response to be the issue here. There is a cache write with the full cache key (e. g. rawContent/user/repo|branch|route/index.html) happening in the handling of the redirect response. But the written body here is empty. In the triggered request from the redirect response the server then finds a cache item to the key and serves the empty body. A quick fix is the check for empty file responses mentioned in 1.
3. The decision to redirect the user comes quite far down in the upstream function. Before that happens a lot of stuff that may not be important since after the redirect response comes a new request anyway. Also, I suspect that this causes the caching problem because there is a request to the forge server and its error handling with some recursions happening before. I propose to move two of the redirects before "Preparing"
4. The recursion in the upstream function makes it difficult to understand what is actually happening. I added some more logging to have an easier time with that.
5. I changed the default behaviour to append a trailing slash to the path to true. In my tested scenarios it happened anyway. This way there is no recursion happening before the redirect.

I am not developing in go frequently and rarely contribute to open source -> so feedback of all kind is appreciated

closes #164

Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/292
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: crapStone <codeberg@crapstone.dev>
Co-authored-by: Hoernschen <julian.hoernschemeyer@mailbox.org>
Co-committed-by: Hoernschen <julian.hoernschemeyer@mailbox.org>
2024-02-26 22:21:42 +00:00
..
acme Add config file and rework cli parsing and passing of config values (#263) 2024-02-15 16:08:29 +00:00
cache Add config file and rework cli parsing and passing of config values (#263) 2024-02-15 16:08:29 +00:00
certificates Add config file and rework cli parsing and passing of config values (#263) 2024-02-15 16:08:29 +00:00
context Security Fix: clean paths correctly to avoid circumvention of BlacklistedPaths 2023-08-27 10:13:15 +02:00
database Fix certificate renewal (#209) 2023-03-20 22:57:26 +00:00
dns Add config file and rework cli parsing and passing of config values (#263) 2024-02-15 16:08:29 +00:00
gitea FIX blank internal pages (#164) (#292) 2024-02-26 22:21:42 +00:00
handler FIX blank internal pages (#164) (#292) 2024-02-26 22:21:42 +00:00
upstream FIX blank internal pages (#164) (#292) 2024-02-26 22:21:42 +00:00
utils Security Fix: clean paths correctly to avoid circumvention of BlacklistedPaths 2023-08-27 10:13:15 +02:00
version Release via CI (#94) 2022-06-14 20:35:11 +02:00
startup.go Add config file and rework cli parsing and passing of config values (#263) 2024-02-15 16:08:29 +00:00