Tuesday, 25 April 2017

What happens if your server does XHR to itself?

I was digging into server side rendering with Angular this week. It seems architected to be totally isomorphic, so if you are getting data on the server or the client, it's the same line of code that runs. Therefore it would make a call like this.http.get('/myurl'); where this.http would be an instance of Http from @angular/http.

On the client side, this is super clear. It means the browser is making an XHR request to my server.

On the server side... what is actually happening behind the scenes? I imagine the node server, being completely unaware of its domain, will make a regular http request, with DNS lookup and everything, just to find itself?

Is that accurate?



via Dave Stein

No comments:

Post a Comment