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](https://codeberg.org/Codeberg/pages-server/src/commit/974229681f4cc7f1ed31df9b05eabef2df013809/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
8b1f497bc4
Allow to use certificate even if domain validation fails ( #160 )
...
- Currently if the canonical domain validations fails(either for
legitimate reasons or for bug reasons like the request to Gitea/Forgejo
failing) it will use main domain certificate, which in the case for
custom domains will warrant a security error as the certificate isn't
issued to the custom domain.
- This patch handles this situation more gracefully and instead only
disallow obtaining a certificate if the domain validation fails, so in
the case that a certificate still exists it can still be used even if
the canonical domain validation fails. There's a small side effect,
legitimate users that remove domains from `.domain` will still be able
to use the removed domain(as long as the DNS records exists) as long as
the certificate currently hold by pages-server isn't expired.
- Given the increased usage in custom domains that are resulting in
errors, I think it ways more than the side effect.
- In order to future-proof against future slowdowns of instances, add a retry mechanism to the domain validation function, such that it's more likely to succeed even if the instance is not responding.
- Refactor the code a bit and add some comments.
Co-authored-by: Gusted <postmaster@gusted.xyz >
Co-authored-by: 6543 <6543@obermui.de >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/160
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2023-02-10 01:38:15 +00:00
Gusted and Gusted
513e79832a
Use correct log level for CheckCanonicalDomain ( #162 )
...
- Currently any error generated by requesting the `.domains` file of a repository would be logged under the info log level, which isn't the correct log level when we exclude the not found error.
- Use warn log level if the error isn't the not found error.
Co-authored-by: Gusted <postmaster@gusted.xyz >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/162
Reviewed-by: Otto <otto@codeberg.org >
2023-01-22 18:52:21 +00:00
98d198d419
Safely get certificate's leaf ( #150 )
...
- It's not guaranteed that `tls.X509KeyPair` will set `c.Leaf`.
- This patch fixes this by using a wrapper that parses the leaf
certificate(in bytes) if `c.Leaf` wasn't set.
- Resolves #149
Co-authored-by: Gusted <postmaster@gusted.xyz >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/150
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2023-01-04 04:51:27 +00:00
f2f943c0d8
Remove unnecessary conversion ( #139 )
...
- Remove unnecessary type conversion.
- Enforce via CI
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/139
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-11-15 16:15:11 +01:00
3c61a39864
Enable http/2 support ( #137 )
...
As per [the documentation](https://pkg.go.dev/net/http#Serve ), it doesn't enable HTTP2 by-default, unless we enable it via the `NextProtos` option.
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/137
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-11-12 22:25:20 +01:00
bf9a08e1fd
Fatal on ACME Client creation failure ( #133 )
...
- For production(*cough* Codeberg *cough*), it's important to not use
mock certs. So fail right from the start if this is the case and not try
to "handle it gracefully", as it would break production.
- Resolves #131
CC @6543
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/133
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-11-07 16:27:37 +01:00
091e6c8ed9
Add explicit logging in GetBranchTimestamp ( #130 )
...
- Logs are currently indicating that it's returning `nil` in valid
scenarios, therefor this patch adds extra logging in this code to
better understand what it is doing in this function.
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/130
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-09-18 16:13:27 +02:00
2a730b2439
Update README ( #128 )
...
- Update readme accordingly to the https://codeberg.org/Codeberg/pages-server/commit/876a53d9a245c11c58b61617052f7f2281d16358
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/128
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-09-13 23:26:45 +02:00
8f2699407d
Make verbose checks in tryBranch ( #127 )
...
- It's likely that the tryBranch is returning false when it should be returning true, make these logs more verbose so they show up on production logs.
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/127
Reviewed-by: 6543 <6543@obermui.de >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-09-13 23:06:31 +02:00
1ae50735a1
Add host to handler logging ( #123 )
...
- Add the host to the Handler's logging fields, so you don't just see the path, but also which domain was being requested.
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/123
Reviewed-by: 6543 <6543@noreply.codeberg.org >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-08-13 18:03:31 +02:00
f72bbfd85f
Fix just dev ( #121 )
...
- Use the correct log level command, since 876a53d9a2
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/121
Reviewed-by: 6543 <6543@noreply.codeberg.org >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-08-12 05:24:05 +02:00
876a53d9a2
Improve logging ( #116 )
...
- Actually log useful information at their respective log level.
- Add logs in hot-paths to be able to deep-dive and debug specific requests (see server/handler.go)
- Add more information to existing fields(e.g. the host that the user is visiting, this was noted by @fnetX).
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/116
Reviewed-by: 6543 <6543@noreply.codeberg.org >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-08-12 05:06:26 +02:00
fd24b4a2bc
Pass logger to fasthttp ( #98 )
...
- Use a logger with `FASTHTTP` prefix as fasthttp's logger so it's easy to see what fasthttp is logging in console/journal.
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/98
Reviewed-by: 6543 <6543@noreply.codeberg.org >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-07-12 15:32:48 +02:00
48a49f69a7
Increase concurrent connections to default value ( #99 )
...
Use the default value of `256 * 1024` for the concurrency limit, this will mean that the server will be able to handle more connections.
Co-authored-by: Gusted <williamzijl7@hotmail.com >
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/99
Reviewed-by: 6543 <6543@noreply.codeberg.org >
Co-authored-by: Gusted <gusted@noreply.codeberg.org >
Co-committed-by: Gusted <gusted@noreply.codeberg.org >
2022-07-03 13:20:02 +02:00