Redirecting in Fastboot


#1

I’m having trouble finding what is the definitive way to transition to another Route when rendering server side in Fastboot.

The situation is that a user’s session has become invalidated, and their response has yielded a 401. My Ember application logs the user out, however I’m stuck as to how I redirect the user to login while still in the Fastboot render.

Any help would be greatly appreciated!


#2

Assuming you have a route like 'login', you can do something like this in your Route

if (notAuthorized) {
  this.transitionTo('login');
}

That should work in both fastboot and the browser. In fastboot, a transition like that should result in the fastboot server sending a 302 redirect to the other URL.