Openacs uses the hostname parameter in the config.tcl file of your server, and the headers of the conection to set the secure location,
You can take a look to this too procs if you want to dig more in the matter.
security::get_secure_location
util_current_location
I hope this will help you