Fix port determination

[fixes #492]

We were doing a port job of determining when to add the port to a fully
qualified url and erred on the side of doing it all the time rather than
doing it only when necessary. This could cause problems.

This will also require a configuration change on the server to make sure
that the protocol in the configuration is properly 'https' rather than
'http'.
Better function name
Closes #666: Redirecting from /backpack/login when logged in
Return on redirect from login, and update backpack controller to call redirect(status, location) throughout
Merge pull request #754 from stenington/666-issue-of-the-beast

Redirecting from /backpack/login when logged in

closes #666
Add explanation of `remote_port`, add test.
Update descriptions in local-dist.js
Discover persona audience from request.

* We are going to be serving the backpack from two locations for a
  little while: beta.openbadges.org, and backpack.openbadges.org. This
  means that the audience needs to be derived from the request rather
  than from the server configuration, so that's what this commit does.

* Also, I've done a lot of refactoring to make things generally better,
  hopefully.
Fix some argument orders.
Merge pull request #757 from brianloveswords/492-fix-ssl-images

Fix port determination

fixes #492
Nunjucks production:

Always precompile templates as part of `npm start`;
include production nunjucks and template js for client-side
rendering if NODE_ENV = production.
Change variable name to be clearer.
Fix test to not overwrite conf.
Merge pull request #755 from brianloveswords/fix-persona-audience

Discover persona audience from request.
Remove template precompiling from npm start, add to README
Remove and ignore precompiled template file
Fix version in package.json
Fix missing quote in npm start
Merge branch 'development' of github.com:mozilla/openbadges into development
Fix conmock to mirror express api.