Skip to content

RequireHost and reverse proxy #42252

@heggi

Description

@heggi

My app has 2 gRPC services, one is for external requests with authentication and second for internal requests from other apps without any auth.

My app works in container, so I configure Kestrel for listen 80 and 88 ports (80 for internal requests and 88 for external) and add RequireHost to both services:

app.MapGrpcService<ExternalService>().RequireHost("*:88");
app.MapGrpcService<InternalService>().RequireHost("*:80");

My reverse proxy listens 443 port with ssl and proxing request as http to port 88 of my app, but nothing works...
If I change port in RequireHost to 80 - works again.

In debug I see this line:
[Microsoft.AspNetCore.Hosting.Diagnostics] Request starting HTTP/2 POST http://my.external.domain/ExternalService.Sample/Test application/grpc -
And I think that RequireHost uses port from this url (translated via forwarding headers) instead of actual Kestrel port.

How can I filter requests via actual Kestrel port?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Status: No Recent Activityold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions