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

Add option to add additional forwarders to ForwardedHeadersMiddleware #253

Closed YvonneArnoldus closed 7 years ago

YvonneArnoldus commented 7 years ago

Problem: Not all webservers seem to use the default ForwardedHeaders (X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto) but use their own headers.

Example: Azure doesn't the X-Forwarded-Proto header when SSL is used but you need to check the content of X-ARR-SSL to see if https is used.

By making it possible to add additional forwarders to the ForwardedHeadersMiddleware you can use this Middleware for all webservers without the need to create your own custom middleware to catch the webserver that have their own headers.

dnfclas commented 7 years ago

@YvonneArnoldus, Thanks for your contribution. To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla2.dotnetfoundation.org.

It will cover your contributions to all .NET Foundation-managed open source projects. Thanks, .NET Foundation Pull Request Bot

dnfclas commented 7 years ago

@YvonneArnoldus, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.
Thanks, .NET Foundation Pull Request Bot

Tratcher commented 7 years ago

Something seems wrong with your branching. Can you rebase your changes on the latest dev?

muratg commented 7 years ago

@YvonneArnoldus were you planning to continue to work on this PR? We will need to review the scenario further and will request some changes if we decide to take this in.

YvonneArnoldus commented 7 years ago

@muratg,

I'm done working with the PR unless you need me to make additional changes.

Tratcher commented 7 years ago

@YvonneArnoldus The new structure does not provide much value. The abstract Forwarder gives you the HttpContext and no other help, it might as well be a separate middleware. If we're going to help people plug in other forwarders then we should provide a more structured approach for them.

YvonneArnoldus commented 7 years ago

@Tratcher I've tried to create a solution that wouldn't break the current implementations. I haven't found a solution to create a more structured approach that wouldn't break the current implementation.

Tratcher commented 7 years ago

Thanks for digging into it. Let us know if you come up with anything in the future.