Feature request: Being able to determine if a request has matched a reverse proxy route in middleware
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 933
- Avg merge
- 12d 18h
- Merged PRs (30d)
- 2
Description
I have a middleware (outside of the reverse proxy world) that needs to do some stuff. I do not want to do this stuff if the current request is getting proxied. The only way I have found to reliably determine this is like this:
```
app.Use(async (context, next) =>
{
// Is there a better way of determining if the current request is a reverse proxy endpoint?
var isReverseProxyEndpoint = context.GetEndpoint()?.Metadata.OfType().Any() == true;
if (isReverseProxyEndpoint) { await next(); return; } // Skip
```
I feel slightly not at ease doing it this way. Not sure if it's correct or if things might break in upcoming versions.
Kind regards, Emil
Edit: This does not work for MapForwarder(...)
Contributor guide
Assessment
This issue has not been assessed yet.