HTTPS redirection never turns on
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee src/Exceptionless.Web/Program.cs alrededor de las líneas 271–275 y comprueba cómo está configurada la redirección a HTTPS en relación con UseForwardedHeaders() y RunAsync(). El issue sugiere eliminar la comprobación de la dirección enlazada fuera de Development; inspecciona las opciones existentes y el comportamiento del middleware antes de elegir ese cambio. Se considera terminado cuando las solicitudes HTTP se redirigen a HTTPS si hay un endpoint HTTPS configurado, mientras que las solicitudes que ya se reconocen como HTTPS no se redirigen.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Program.cs decides whether to add UseHttpsRedirection() by checking the server's bound addresses while the pipeline is being built. Kestrel only fills in those addresses when the app starts, so the list is always empty at that point and the middleware is never added.
Where
src/Exceptionless.Web/Program.cs L271-L275:
var serverAddressesFeature = app.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>();
bool ssl = options.AppMode != AppMode.Development && serverAddressesFeature is not null && serverAddressesFeature.Addresses.Any(a => a.StartsWith("https://"));
if (ssl)
app.UseHttpsRedirection();
This runs before app.RunAsync().
What happens
A self-hosted instance listening on both HTTP and HTTPS (for example ASPNETCORE_URLS=http://+:8080;https://+:8443 with a certificate) serves plain HTTP on the HTTP port with no redirect. Setting an HTTPS port (EX_HTTPS_PORT) has no effect.
A minimal ASP.NET Core 10 app shows the timing:
var app = WebApplication.CreateBuilder(args).Build();
var f = app.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>()!;
Console.WriteLine($"Before start: [{string.Join(",", f.Addresses)}]");
await app.StartAsync();
Console.WriteLine($"After start: [{string.Join(",", f.Addresses)}]");
With ASPNETCORE_URLS=http://127.0.0.1:59123 this prints Before start: [] and After start: [http://127.0.0.1:59123].
Expected
When the server has an HTTPS endpoint outside Development, HTTP requests are redirected to HTTPS.
Suggested fix
Add app.UseHttpsRedirection() outside Development without the address check. The middleware resolves the HTTPS port lazily on the first request (from HttpsRedirectionOptions.HttpsPort, the HTTPS_PORT setting, or the bound addresses) and does nothing, with a single warning, when there is no HTTPS endpoint. It runs after UseForwardedHeaders(), so requests that arrive over HTTPS at a trusted proxy are not redirected. If redirection should stay opt-in, gate it on a config value instead (for example the existing EnableSsl option) rather than on bound addresses.
- Lenguaje dominante
- C#
- Estrellas
- 2.5k
- Forks
- 508
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 40
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de exceptionless/Exceptionless
-
bug documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
exceptionless/Exceptionless#2707 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
exceptionless/Exceptionless#2706 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
exceptionless/Exceptionless#2705 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
exceptionless/Exceptionless#2704 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
exceptionless/Exceptionless#2703 ·
Los mantenedores suelen responder en 1 día
Todos los issues de exceptionless/Exceptionless
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
area: core priority: low type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
RicoSuter/Namotion.Interceptor#863 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
bitfoundation/bitplatform#14428 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area-cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
0.3.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día