0

I have an emberjs app where all requests are sent through a proxy that inserts some user information into the header. In my ember app I would like to read that header data and save it as a 'current user' object for every route. I cannot find how I would get access to the route request headers.

In a node app I would do this:

app.get('/', function(req, res){
  req.get('Content-Type');
});

But my emberjs route looks like this (no request variable):

Router.map(function() {
 this.route('dashboard');
}

How do I get a request object in emberjs to read the headers?

Malissa
  • 86
  • 1
  • 4
  • Can you be more specific as to why you want the request headers and what you want to do with them? – GManProgram Feb 22 '17 at 20:50
  • My proxy handles all authentication and only sends authenticated users to the ember app. The header contains the user payload. – Malissa Feb 22 '17 at 21:36
  • Correct me if I am wrong, but it sounds like you want to get the HTTP Headers for the initial get of the web page, which has been discussed over here. http://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript It might be easier to expose an endpoint to return the user information – GManProgram Feb 23 '17 at 16:21

1 Answers1

0

Ember is a Single Page Application framework, so when changing routes you are not making a page request and so there are no request header associated with a route.

GManProgram
  • 161
  • 2
  • 11