Back to Practical Aspnetcore

Host Matching on your middleware version 2

projects/endpoint-routing/new-routing-24/README.md

latest515 B
Original Source

Host Matching on your middleware version 2

This example demonstrates on how to configure your endpoint to respond to a request from a specific host. In this example, GET / returns a different result depending whether you access it from localhost:8111 and localhost:8112.

This produces the same exact effect as the previous example except that here we use IEndpointConventionBuilder.WithMetadata and HostAttribute instead of IEndpointConventionBuilder.RequireHost.