How to get the hostname in asp.net when hosted in kubernetes/istio?

12/16/2019

I have an asp.net server into which I'm inserting custom middleware to redirect to an authorization service that requires user interaction. When I send the user to the auth site, I need to supply a return url for that site to send them back to when they're done. I know I can do this using

context.Request.Host

The issue I'm having is that my asp server is running in kubernetes and cluster networking is constrained by istio. This means that the host name I'm getting from the above is localhost. I can think of a few ways to solve this - e.g. adding a hostname env variable and having localhost be replaced by that in my middleware, however I'd ultimately like to package up this middleware and have other teams in my company use it.

Can I configure istio to pass through the hostname?

-- Andy
asp.net
istio
kubernetes-ingress

0 Answers