This is a Ruby gem providing a Rack middleware to help Heroku add-on providers displaying a customized header for users coming from a single sign-on session.
Use it just like any Rack middleware:
require 'heroku/nav'
use Heroku::Nav::Provider
That will fetch the latest header from our API and insert it as the first element inside the body tag when the cookie "heroku-nav-data" is defined. ie. in your SSO login controller you might have something like: response.set_cookie('heroku-nav-data', :value => params['nav-data'], :path => '/')
For Rails apps, add it to your Gemfile:
gem 'heroku-nav', :require => 'heroku/nav'
And add the middleware like:
config.middleware.use Heroku::Nav::Provider
By default the header will be inserted only in responses with status 200. You can insert it in responses with different status codes with the :status
config param:
config.middleware.use Heroku::Nav::Provider, :status => [200, 404]
To don't display the header on a given request path you can use the :except
config param which takes a regex to compare to the path:
config.middleware.use Heroku::Nav::Provider, :except => /admin/
For the special case of the root path, "/" you can use the regex /root_path/
config.middleware.use Heroku::Nav::Provider, :except => [/root_path/,/user/]
Maintained by Pedro Belo, contributions by Todd Matthews and David Dollar.
Released under the MIT license. https://github.com/heroku/heroku-nav