UseStatusCodePagesWithReExecute('/not-found') intercepts all 4xx
responses and re-executes the pipeline as POST /not-found.
Since /not-found is a Blazor component requiring antiforgery, the
re-executed POST would fail with 400 (no CSRF token).
API controllers now return proper 401/403 for unauthenticated
requests. All 61 integration tests pass.
UseAntiforgery() was before UseAuthentication(), causing all POST
requests to API controllers to get 400 (missing CSRF token) before
auth could return 401. Moving it after authorization ensures:
1. Auth middleware runs first → unauthenticated requests get 401
2. Antiforgery middleware validates tokens only for requests
that pass auth (Blazor components)
3. API controllers and SignalR hubs work without CSRF tokens
Roles (Admin, Viewer, etc.) must exist before any user registration
attempts to add a user to a role. The seeding was only in the old
Heimdall.Api/Program.cs — moved to Web/Program.cs and runs in ALL
environments (not skipped in Testing).
Now 54/61 integration tests pass (was 6/61). Remaining 7 failures
are all 'expected 401 got 400' — pre-existing auth middleware
difference.
- Add InternalsVisibleTo for Heimdall.Api.Tests and
Heimdall.IntegrationTests in Web.csproj
- Add partial class Program for WebApplicationFactory<Program>
- Pass builder.Environment.EnvironmentName instead of env var
so AddInfrastructure correctly detects Testing environment
- Skip DATABASE_URL check, Hangfire setup, migrations, and
recurring jobs when environment is Testing
- Update test project references from Heimdall.Api to Heimdall.Web
Heimdall.Api controllers/hubs/filters were exact duplicates of
files already in Heimdall.Web (same namespace, same content).
The Api project was a leftover from before the single-image merge.
Changes:
- Add missing registrations to Web/Program.cs (JWT Bearer auth,
rate limiting, controllers with ExceptionFilter, FluentValidation,
SignalR + broadcast services, OpenAPI/Scalar, CORS, hub mappings)
- Add FluentValidation.AspNetCore, Scalar.AspNetCore,
Microsoft.AspNetCore.OpenApi NuGet packages to Web.csproj
- Remove Heimdall.Api from solution and delete the project
- All routes continue working at their existing paths
The HeimdallApiClient calls the API via HTTP on localhost.
Inside Docker, the app listens on port 8080 (ASPNETCORE_URLS),
but the default was 5000 (host-mapped port) — causing connection
refused on all API calls from Blazor Server UI.
Fix: change default from localhost:5000 to localhost:8080.
- Remove `using var` from dpCert so the cert stays alive for
ProtectKeysWithCertificate (was disposed, causing
CryptographicException)
- Add query filter on DiscoveredStreamUrl for model warning #10622
- Simplify migration retry: call Migrate() directly instead of
GetPendingMigrations()+Migrate() to reduce transient startup noise
Combine Heimdall.Web and Heimdall.Workers into one process/image.
Hangfire background jobs now run inside the web process.
- Move job classes to Infrastructure/Jobs/ (no Worker SDK dependency)
- Add Hangfire server + recurring jobs to Web/Program.cs
- Add missing AddInfrastructure/AddApplication DI registrations to Web
- Rename image: heimdall (was heimdall-web / heimdall-workers)
- Remove src/Heimdall.Workers project entirely
- Remove tests/Heimdall.Workers.Tests (placeholder)
- Simplify Dockerfile: single build target, no workers publish
- Update docker-compose files: one service heimdall, no workers
- Update Makefile, .env.example
- Remove redundant antiforgery check from /_auth/signin and
/_auth/signout
(JWT validation is sufficient security; antiforgery tokens
fail silently because the JS caller never includes one)
- Add ILogger structured logging to both endpoints
- Make AuthHelper.SignInAsync return bool so Blazor pages
can detect failure
- Show user-friendly error messages in Login.razor and
Register.razor when cookie creation fails
The service was registered only as AuthenticationStateProvider (base class),
but Login.razor, Register.razor, and MainLayout.razor inject the concrete
@inject HeimdallAuthStateProvider. Blazor's DI could not resolve it,
causing InvalidOperationException on page render.
Fix: register the concrete type first, then make the base class
registration resolve to the same instance via GetRequiredService.
- 🔴 Fix startup crash when DB is temporarily unavailable: add 5x retry
with exponential backoff to Database.MigrateAsync() in API and Workers
- 🔴 Fix EF Core 'required navigation with query filter' warnings:
add matching soft-delete query filters to AgentSetting, CameraCredentials,
CameraDetectionProfile, UserSite
- 🔴 Add Sentry error tracking to Workers (Hangfire background jobs)
- 🟡 Make Sentry/GlitchTip DSN configurable via SENTRY_DSN env var
(applies to API, Web, Agent, Workers)
- 🟡 Suppress EF Core RedundantIndexRemoved informational messages
Closes GlitchTip #538
Add Sentry.AspNetCore v6.7.0 with hardcoded DSN constant
(not overridable by env) pointing to GlitchTip instance at
https://glitchtip.tordais.cc/6.
Same DSN configured across all three entry-point projects:
- Heimdall.Api
- Heimdall.Agent
- Heimdall.Web
- Login: redirect to original page after auth via returnUrl query param
- RedirectToLogin: encodes current URL as ?returnUrl=/path
- API URL: configurable via appsettings.json ApiBaseUrl or API_BASE_URL env
- NotFound page: preserved from template