Q:

.Net core : Get header origin dynamically

I'm using Angular7/.Net core web API and i need to retrieve dynamically the origin url value of the frontend through .net core API as  http://localhost:4200 or http://domainName.com.
I have used the code below but it did not match with .net core 
model.origin = Request.Headers.GetValues("Origin");

A:

If you're doing cross origin request than you should indeed get the Origin header from the request. 
However not exactly as you suggest in your post.
Try:
var hasOrigin = this.Request.Headers.TryGetValue("Origin",  out var origin);

Also if you're running behind a proxy, you will need to setup host header forwarding.
On nginx for example, you would do that like this: proxy_set_header Host  $host;

