1 Core fixes

Fixes for the generation of shared URLs and https. Also adds detection
of apache or nginx to make sure the correct port is used in when the URL
is generated.