I have one API and two different domain. How can I check which domain host triggered api request?
Example:
- API: example.API.com
- Domain1: example.Domain1.com
- Domain2: example.Domain2.com
and I want to know which domain call my API?
I used C# for my code, maybe there is a ready way to solve my problem but if not then maybe some advice on how to approach the problem?
I try code.
string host = _httpContextAccessor.HttpContext?.Request.Headers.Referer.FirstOrDefault();
This code gives me the full url of the client, but I don't know if that's a good way because this can be null.