mirror of
https://github.com/alexhopeoconnor/bom-local-service.git
synced 2026-10-04 03:28:11 +10:00
Make HTTPS redirection optional and remove authorization
- HTTPS redirection now configurable via ENABLE_HTTPS_REDIRECTION env var - Removed UseAuthorization() for Docker flexibility - Improved regex group validation in ScrapingService
This commit is contained in:
+11
-2
@@ -34,8 +34,17 @@ if (app.Environment.IsDevelopment())
|
||||
app.MapOpenApi();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
// HTTPS redirection is optional and disabled by default for Docker flexibility
|
||||
// Users can enable it by setting ENABLE_HTTPS_REDIRECTION=true environment variable
|
||||
// or EnableHttpsRedirection=true in appsettings.json
|
||||
var enableHttpsRedirection = builder.Configuration.GetValue<bool>("EnableHttpsRedirection", false) ||
|
||||
Environment.GetEnvironmentVariable("ENABLE_HTTPS_REDIRECTION")?.Equals("true", StringComparison.OrdinalIgnoreCase) == true;
|
||||
if (enableHttpsRedirection)
|
||||
{
|
||||
app.UseHttpsRedirection();
|
||||
}
|
||||
|
||||
// No authorization required - service is designed to run behind a reverse proxy if auth is needed
|
||||
app.MapControllers();
|
||||
|
||||
// Cleanup on shutdown
|
||||
|
||||
Reference in New Issue
Block a user