Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Consider adding a RequireHttps middleware #31

Closed
rynowak opened this issue Feb 24, 2016 · 12 comments
Closed

Consider adding a RequireHttps middleware #31

rynowak opened this issue Feb 24, 2016 · 12 comments
Assignees
Milestone

Comments

@rynowak
Copy link
Member

rynowak commented Feb 24, 2016

We have [RequireHttps] in MVC as a filter that redirects you to https:// - we should consider adding the same kind of thing as a middleware.

@Eilon
Copy link
Member

Eilon commented Feb 29, 2016

BTW in MVC it's called RequireHttpsAttribute. Plus, definitely want to make sure it supports custom SSL ports, as we recently added to MVC as well: aspnet/Mvc#4113

@rynowak rynowak changed the title Consider adding a HTTPS-only middleware Consider adding a RequireHttps middleware Feb 29, 2016
@rynowak
Copy link
Member Author

rynowak commented Feb 29, 2016

Fixed, thanks!

@davidfowl
Copy link
Member

It should probably share the options and all that.

@muratg
Copy link
Contributor

muratg commented Feb 29, 2016

Do we want to do this for RC2? Doesn't seem to hard, though I'm not sure about the testing.

@Eilon
Copy link
Member

Eilon commented Feb 29, 2016

If we want MVC and this middleware to share the option value (not a bad idea, I think), then we'd need a little bit of design on this. I don't think we've ever had this kind of sharing of configuration data before.

@davidfowl
Copy link
Member

Cors and authz do this I think?

@BrennanConroy
Copy link
Member

Currently SslPort is the only option the RequireHttps is using. It resides in MvcOption right now, but ideally we wouldn't have the RequireHttps Middleware depending on Mvc. What should we do about this?

CORS has the CorsPolicy class which Mvc depends on to share options, we could do the same thing and have Mvc depend on BasicMiddleware...

@cwe1ss
Copy link

cwe1ss commented Mar 22, 2016

I don't think it's necessary to share the options. I guess many people will use only one of both methods. And since HTTPS will get more and more common, people will just want to forward everything to HTTPS - hence I believe that having a middleware is even more important than having the RequireHttpsAttribute.

Not sharing the options would simplify this middleware. But of course, +1 on supporting custom ports. This is a must-have for Azure Service Fabric.

@Tratcher
Copy link
Member

We may do this as part of the UrlRewrite project

@Eilon Eilon assigned Tratcher and unassigned BrennanConroy Jun 29, 2016
@Eilon
Copy link
Member

Eilon commented Jun 29, 2016

@Tratcher I'm parking on your plate in the meantime.

@Tratcher
Copy link
Member

Tratcher commented Sep 6, 2016

This was added to the Rewrite middleware. https://github.com/aspnet/BasicMiddleware/blob/dev/src/Microsoft.AspNetCore.Rewrite/RewriteOptionsExtensions.cs#L96. I don't think we need an independent middleware for it. @muratg I recommend we close this as done for 1.1.

@rynowak
Copy link
Member Author

rynowak commented Sep 8, 2016

I agree, this is a better solution 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants