Separate dashboard port, first-run password setup and default trusted proxies
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a34ff96490
commit
c22d452720
25 files changed
+654
-109
No files matched your search
@@ -7,6 +7,7 @@ using Flypaper.Http.Matching;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Features;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Flypaper.Http.Middleware;
|
||||
|
||||
@@ -14,17 +15,24 @@ internal sealed class FlypaperMiddleware(
|
||||
RequestDelegate next,
|
||||
TrapMatcher matcher,
|
||||
TrapRunner runner,
|
||||
IOptions<PortOptions> ports,
|
||||
TimeProvider timeProvider)
|
||||
{
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
var request = context.Request;
|
||||
if (IsInternalHealthProbe(context) || matcher.Match(request.Host.Host, request.Path.Value) == TrapMatch.None)
|
||||
if (context.Connection.LocalPort == ports.Value.Dashboard || IsInternalHealthProbe(context))
|
||||
{
|
||||
await next(context);
|
||||
return;
|
||||
}
|
||||
|
||||
var request = context.Request;
|
||||
if (matcher.Match(request.Host.Host, request.Path.Value) == TrapMatch.None)
|
||||
{
|
||||
context.Response.StatusCode = StatusCodes.Status404NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
var session = new TrapSession(
|
||||
Guid.NewGuid(),
|
||||
TrapProtocol.Http,
|
||||
|
||||
Reference in new issue
Block a user