[backend] Allow admins to specity extra web domains the instance is accessible from
For frontends that expect relative paths
This commit is contained in:
parent
30cf0db0fb
commit
834661981a
3 changed files with 8 additions and 0 deletions
|
@ -32,6 +32,9 @@ public sealed class Config
|
|||
[Required] public string WebDomain { get; init; } = null!;
|
||||
[Required] public string AccountDomain { get; init; } = null!;
|
||||
[Range(1, 100000)] public int CharacterLimit { get; init; } = 8192;
|
||||
|
||||
public string? ExtraWebDomains { get; init; }
|
||||
public string[] ExtraWebDomainsArray => ExtraWebDomains?.Split(',') ?? [];
|
||||
}
|
||||
|
||||
public sealed class SecuritySection
|
||||
|
|
|
@ -22,6 +22,7 @@ public class RequestVerificationMiddleware(
|
|||
public bool IsValid(HttpRequest rq)
|
||||
{
|
||||
if (rq.Host.Host == config.Value.WebDomain) return true;
|
||||
if (config.Value.ExtraWebDomainsArray.Contains(rq.Host.Host)) return true;
|
||||
if (rq.Host.Host == config.Value.AccountDomain && rq.Path.StartsWithSegments("/.well-known"))
|
||||
{
|
||||
if (rq.Path == "/.well-known/webfinger") return true;
|
||||
|
|
|
@ -10,6 +10,10 @@ WebDomain = shrimp.example.org
|
|||
AccountDomain = example.org
|
||||
;; End of problematic settings block
|
||||
|
||||
;; Extra web domains this instance allows access from, separated by commas.
|
||||
;; Certain frontends such as Akkoma-FE may require reverse proxy configurations that send requests through the frontend domain.
|
||||
;ExtraWebDomains =
|
||||
|
||||
;; Maximum number of characters allowed for local notes (must not be larger than the global limit, which is 100000 characters)
|
||||
CharacterLimit = 8192
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue