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
Add explanation of `remote_port`, add test.
Update descriptions in local-dist.js
Merge pull request #757 from brianloveswords/492-fix-ssl-images

Fix port determination

fixes #492