Cache the port used by the server and pass that along to the process_request_alter hook.