You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
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...
Regular request:
SSR Request:
Question:
When SSR is taking place, how do I detect the actual origin of the request?
The text was updated successfully, but these errors were encountered:
rohan-buechner
changed the title
SSR & does not append Origin header.
SSR & does not append headers.
Oct 13, 2017
When SSR is taking place, how do I detect the actual origin of the request?
If the browser chooses not to send an Origin header, there's nothing SSR can do to change that - the request has already been sent. In general you should not expect all requests to have Origin headers (see info).
Normally if you're working with a reverse proxy, it will be possible to configure the reverse proxy to attach the original URL as an extra header, but you'll need to see docs for your reverse proxy about how to do that (or even implement it yourself, if you have created your own reverse proxy).
@SteveSandersonMS I literally (about an hour ago), found the asp-prerender-data tag on another question you answered ... this was exactly what I needed, and allowed me to solve/progress from my roadblock. Thank you :)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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)
The API
I have an endpoint that looks like this:
When doing a regular Ajax fetch from my front end app, I will see a log entry in the console that matches my origin.
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...
Regular request:

SSR Request:

Question:
When SSR is taking place, how do I detect the actual origin of the request?
The text was updated successfully, but these errors were encountered: