Moritz Marquardt
7694deec83
Fix missing return on redis parsing issues
...
Suggested-By: Gusted (https://codeberg.org/Codeberg/pages-server/pulls/301/files#issuecomment-1732054 )
2024-04-18 19:07:34 +02:00
Moritz Marquardt
5bf538c5ec
Format go code
2024-04-18 19:07:34 +02:00
Moritz Marquardt
584ba5c74d
Fix cached error when .domains is not readable (fixes https://codeberg.org/Codeberg/Community/issues/1512 )
...
Co-authored-by: @algernon
2024-04-18 19:07:34 +02:00
Moritz Marquardt
f6d3147ba1
Fix tests not running
2024-04-18 19:07:34 +02:00
Moritz Marquardt
48e919a7bf
Cache empty files & fix #303 (missing content cache)
2024-04-18 19:07:34 +02:00
Moritz Marquardt
46c8daacba
Move redis config to CacheConfig struct, add cache prefixes & trace logging
2024-04-18 19:07:34 +02:00
Moritz Marquardt
e1a22d5f4c
Make it possible to actually use redis for caching through the config flags
2024-04-18 19:07:34 +02:00
Moritz Marquardt
c4181d1206
Move to []byte for caching and make it compile
2024-04-18 19:07:34 +02:00
Moritz Marquardt
5b6eecc75f
Add redis for caching, first try during a train ride so expect it to not be working yet
2024-04-18 19:07:34 +02:00
Jean-Marie 'Histausse' Mineau
b8b9886ee1
fix lint
2024-04-18 19:07:34 +02:00
Jean-Marie 'Histausse' Mineau
c89ce83b6b
simplify wildecard logic
2024-04-18 19:07:34 +02:00
Jean-Marie 'Histausse' Mineau
03881382a4
Add option to disable DNS ACME provider ( #290 )
...
This PR add the `$NO_DNS_01` option (disabled by default) that removes the DNS ACME provider, and replaces the wildcard certificate by individual certificates obtained using the TLS ACME provider.
This option allows an instance to work without having to manage access tokens for the DNS provider. On the flip side, this means that a certificate can be requested for each subdomains. To limit the risk of DOS, the existence of the user/org corresponding to a subdomain is checked before requesting a cert, however, this limitation is not enough for an forge with a high number of users/orgs.
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/290
Reviewed-by: Moritz Marquardt <momar@noreply.codeberg.org>
Co-authored-by: Jean-Marie 'Histausse' Mineau <histausse@protonmail.com>
Co-committed-by: Jean-Marie 'Histausse' Mineau <histausse@protonmail.com>
2024-04-18 17:05:20 +00:00
caelandb
dd6d8bd60f
fixed one grammar error. ( #297 )
...
Just a small grammar change in the README.
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/297
Reviewed-by: crapStone <codeberg@crapstone.dev>
Co-authored-by: caelandb <bothacaelan@gmail.com>
Co-committed-by: caelandb <bothacaelan@gmail.com>
2024-03-12 21:50:17 +00:00
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
crapStone
7e80ade24b
Add config file and rework cli parsing and passing of config values ( #263 )
...
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/263
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: crapStone <me@crapstone.dev>
Co-committed-by: crapStone <me@crapstone.dev>
2024-02-15 16:08:29 +00:00
crapStone
c1fbe861fe
rename gitea to forge in html error messages ( #287 )
...
closes #286
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/287
Reviewed-by: Andreas Shimokawa <ashimokawa@noreply.codeberg.org>
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2024-02-11 12:43:25 +00:00
Panagiotis "Ivory" Vasilopoulos
a09bee68ad
Meta: Redirect user support to Codeberg/Community ( #277 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/277
Reviewed-by: crapStone <codeberg@crapstone.dev>
Co-authored-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-committed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
2024-01-18 20:35:32 +00:00
Gusted
15916444e1
Fix panic in formatting not found message ( #276 )
...
Fix panic that was found in the logs, `targetOpt` is `nil`:
http2: panic serving 10.0.3.1:[...]: runtime error: invalid memory address or nil pointer dereference
net/http.(*http2serverConn).runHandler.func1()
/usr/local/go/src/net/http/h2_bundle.go:6104 +0x145
panic({0x19c6820, 0x2d66db0})
/usr/local/go/src/runtime/panic.go:884 +0x213
codeberg.org/codeberg/pages/server/handler.handleSubDomain({{0x2008c68, 0xc00047df90}, 0x2, {0x0, 0x0}, {0xc0fe3ef800, 0x55, 0x1f4}, {0xc00047dfa0, 0x1, ...}, ...}, ...)
/woodpecker/src/codeberg.org/Codeberg/pages-server/server/handler/handler_sub_domain.go:59 +0x5e0
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/276
Reviewed-by: crapStone <codeberg@crapstone.dev>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2024-01-18 14:31:46 +00:00
6543
dd5124912e
CI: run on pull only once ( #264 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/264
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2023-11-17 21:46:52 +00:00
crapStone
fffb8ffcb6
remove use of rawInfoPage redirect ( #261 )
...
closes #244
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/261
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-16 17:33:39 +00:00
crapStone
cbb2ce6d07
add go templating engine for error page and make errors more clear ( #260 )
...
ping #199
closes #213
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/260
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-16 17:11:35 +00:00
crapStone
7f0a4e5ca9
small cleanup ( #259 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/259
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-15 17:59:04 +00:00
crapStone
ea68a82cd2
new maintainer ( #256 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/256
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-15 15:25:56 +00:00
crapStone
1e1c67be93
let gitea client send user-agent with version ( #258 )
...
closes #255
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/258
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-15 15:25:14 +00:00
6543
be92f30e64
Update gitea sdk to e23e8aa3004f ( #257 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/257
Reviewed-by: crapStone <codeberg@crapstone.dev>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2023-11-15 10:27:27 +00:00
crapStone
a8272f0ce9
Don't send server version to client ( #254 )
...
closes #247
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/254
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-15 01:49:29 +00:00
thepaperpilot
b6103c6a1b
Chore: Fix env var description ( #251 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/251
Reviewed-by: crapStone <crapstone01@gmail.com>
Co-authored-by: thepaperpilot <thepaperpilot@noreply.codeberg.org>
Co-committed-by: thepaperpilot <thepaperpilot@noreply.codeberg.org>
2023-09-17 16:45:20 +00:00
Moritz Marquardt
ff3cd1ba35
Fix CI pipeline (replace "pipeline" with "steps")
2023-08-27 11:37:17 +02:00
Moritz Marquardt
56d3e291c4
Security Fix: clean paths correctly to avoid circumvention of BlacklistedPaths
2023-08-27 10:13:15 +02:00
6543
d720d25e42
Use http.NoBody as per linter ( #231 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/231
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2023-07-17 19:44:58 +00:00
Gusted
7f318f89a6
Fix escaped error message ( #230 )
...
- This specific message will [already be generated](https://codeberg.org/Codeberg/pages-server/src/commit/974229681f4cc7f1ed31df9b05eabef2df01380/html/error.go#L44 ) when `http.StatusMisdirectedRequest` is set as status with [an empty message](974229681f/html/error.go (L25-L28)
).
- Resolves https://codeberg.org/Codeberg/pages-server/issues/228
Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/230
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Gusted <gusted@noreply.codeberg.org>
Co-committed-by: Gusted <gusted@noreply.codeberg.org>
2023-07-16 22:34:46 +00:00
video-prize-ranch
974229681f
Initial redirects implementation ( #148 )
...
Adds basic support for `_redirects` files. It supports a subset of what IPFS supports: https://docs.ipfs.tech/how-to/websites-on-ipfs/redirects-and-custom-404s/
Example:
```
/redirect https://example.com/ 301
/another-redirect /page 301
/302 https://example.com/ 302
/app/* /index.html 200
/articles/* /posts/:splat 301
```
301 redirect: https://video-prize-ranch.localhost.mock.directory:4430/redirect
SPA rewrite: https://video-prize-ranch.localhost.mock.directory:4430/app/path/path
Catch-all with splat: https://video-prize-ranch.localhost.mock.directory:4430/articles/path/path
Closes #46
Co-authored-by: video-prize-ranch <cb.8a3w5@simplelogin.co>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/148
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: video-prize-ranch <video-prize-ranch@noreply.codeberg.org>
Co-committed-by: video-prize-ranch <video-prize-ranch@noreply.codeberg.org>
2023-03-30 21:36:31 +00:00
6543
970c13cf5c
Readme.md: use matrix.org for room alias
2023-03-21 02:32:25 +01:00
6543
98d7a771be
Readme.md: add link to chat & main repo
2023-03-21 01:53:07 +01:00
Crystal
c40dddf471
Fix certificate renewal ( #209 )
...
A database bug in xorm.go prevents the pages-server from saving a
renewed certificate for a domain that already has one in the database.
Co-authored-by: crystal <crystal@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/209
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Crystal <crystal@noreply.codeberg.org>
Co-committed-by: Crystal <crystal@noreply.codeberg.org>
2023-03-20 22:57:26 +00:00
Crystal
26d59b71f0
Fix typo in integration test log ( #210 )
...
I forgot to update the name of this function in the CI log so it looks like it's running the same test twice even though it's not.
Co-authored-by: crystal <crystal@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/210
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Crystal <crystal@noreply.codeberg.org>
Co-committed-by: Crystal <crystal@noreply.codeberg.org>
2023-03-20 22:52:42 +00:00
6543
c9050e5722
Handle Relative Symlinks ( #205 )
...
enhance #114
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/205
2023-03-11 05:07:17 +00:00
deblan
42d5802b9b
Allow to define default branches ( #125 )
...
This try to address #115
Co-authored-by: Simon Vieille <simon@deblan.fr>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/125
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: deblan <deblan@noreply.codeberg.org>
Co-committed-by: deblan <deblan@noreply.codeberg.org>
2023-02-14 03:03:00 +00:00
6543
0adac9a5b1
fix http -> https redirect and add integration tests for it ( #184 )
...
and more logging
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/184
2023-02-14 02:23:28 +00:00
6543
42b3f8d1b7
use mockery for mock code generation ( #185 )
...
close #181
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/185
2023-02-13 23:13:30 +00:00
6543
9a3d1c36dc
Document more flags & make http port customizable ( #183 )
...
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/183
2023-02-13 20:14:45 +00:00
crystal
46316f9e2f
Fix raw domain for branches with custom domains and index.html ( #159 )
...
fix #156
fix #157
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/159
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: crystal <crystal@noreply.codeberg.org>
Co-committed-by: crystal <crystal@noreply.codeberg.org>
2023-02-11 03:12:42 +00:00
6543
08d4e70cfd
Update Readme to point out new Architecture
2023-02-11 03:39:38 +01:00
6543
5753f7136d
Move acmeClient creation into own file & struct ( #179 )
...
get rid of gobal vars and make make functions with less args :)
tldr: collect funcs and create a own ACME client to manage that stuff
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/179
2023-02-11 02:29:08 +00:00
6543
fd643d15f0
Drop: pogreb support ( #175 )
...
followup of #173
close #95
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/175
2023-02-11 02:04:57 +00:00
6543
272c7ca76f
Fix xorm regressions by handle wildcard certs correctly ( #177 )
...
close #176
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/177
2023-02-11 01:26:21 +00:00
6543
d8d119b0b3
Fix Cache Bug ( #178 )
...
error io.EOF is gracefully end of file read.
so we don't need to cancel cache saving
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/178
2023-02-11 00:31:56 +00:00
6543
1b6ea4b6e1
use same version var on cli app as header
2023-02-10 04:33:28 +01:00
6543
7b35a192bf
Add cert store option based on sqlite3, mysql & postgres ( #173 )
...
Deprecate **pogreb**!
close #169
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/173
2023-02-10 03:00:14 +00:00
foehammer
7fce7cf68b
Added Whitespace Trimming TXT DNS Records ( #152 )
...
Solves https://codeberg.org/Codeberg/Community/issues/823 and https://codeberg.org/Codeberg/pages-server/issues/143
Co-authored-by: foehammer127 <foehammer127@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/152
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: foehammer <foehammer@noreply.codeberg.org>
Co-committed-by: foehammer <foehammer@noreply.codeberg.org>
2023-02-10 01:44:44 +00:00