SSR & does not append headers. #1335
Description
I have an Isomorphic white-labelled app of sorts that needs to be able to differentiate its data by means of supplying a header to each request. EG:
We'll be able to spawn up a new web app & api for a type of product, but then by means of some clever proxy work, we want to be able to expose a web app to different countries via a host name change of sorts. (This difference is required to segregate data at the back end)
1. www.web.foo.usa.com
2. www.web.foo.za.com
The API
1. www.api.foo.com
I have an endpoint that looks like this:
public string search(string text)
{
StringValues foo = "";
if (Request.Headers.TryGetValue("Origin", out foo))
{
Console.WriteLine(foo.ToString());
}
return "bar";
}
When doing a regular Ajax fetch from my front end app, I will see a log entry in the console that matches my origin.
www.web.foo.za.com // thus this was a successful log
BUT..
On the very first request (on server pre-render), or when I disable javascript (no ajax)/ cache clear & hard reload (pre-render again), Origin
seems to be empty... even though the request is successful. (Meaning the ServerSideRenderer completed the request).
Wireshark, seems to confirm my suspicions...
Question:
When SSR is taking place, how do I detect the actual origin of the request?