aspnet / BasicMiddleware

[Archived] Basic middleware components for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
169 stars 84 forks source link

HSTS middleware should explicitly avoid sending the header for localhost #273

Closed javiercn closed 6 years ago

javiercn commented 6 years ago

This will cause a headache in the

dotnet new
dotnet publish
dotnet <app>.dll scenario

Turn it off for localhost by default and provide an option to turn it on if we think it's necessary.

jkotalik commented 6 years ago

What would we consider localhost? I'd assume we need to include localhost, 127.0.0.1, and ::1.

Tratcher commented 6 years ago

This way lies madness....

javiercn commented 6 years ago

@Tratcher We can just have a list of exclusions that we populate by default, with something along the lines of what @jkotalik mentioned (we would have to think through this). That way, if you really want it, you have a way out (and you can exclude additional hosts, for example when you develop against your machine name or any other thing you put in your host file, (for example if you use a .dev domain for development)

jkotalik commented 6 years ago

Excluding additional hosts would be interesting to expose. What would the usability scenario be? Do we want to allow regex matching (for example, to support your .dev scenario)? It seems like we would need to expose two options: a list of excluded domains and a bool for whether to exclude localhost or not.

javiercn commented 6 years ago

@jkotalik Just a list will do, no regex no anything fancier. The scenario is when you setup your box to develop with something different than localhost, which is pretty common. (And obviously to exclude localhost by default)

blowdart commented 6 years ago

I can see the need for this, even if I hate it.

jkotalik commented 6 years ago

@muratg thoughts?

muratg commented 6 years ago

cc @shirhatti @danroth27