code: def test_http_root_url(ray_shutdown):
      @serve.deployment
      def f(_):
          pass
  
      root_url = "https://my.domain.dev/prefix"
  
      port = new_port()
      os.environ[SERVE_ROOT_URL_ENV_KEY] = root_url
      serve.start(http_options=dict(port=port))
      serve.run(f.bind())
      assert f.url == root_url + "/f"
      serve.shutdown()
      ray.shutdown()
      del os.environ[SERVE_ROOT_URL_ENV_KEY]
  
      port = new_port()
      serve.start(http_options=dict(port=port))
      serve.run(f.bind())
      assert f.url != root_url + "/f"
      assert f.url == f"http://127.0.0.1:{port}/f"
      serve.shutdown()
      ray.shutdown()
  
      ray.init(
          runtime_env={"env_vars": {SERVE_ROOT_URL_ENV_KEY: root_url}}
      )
      port = new_port()
      serve.start(http_options=dict(port=port))
      serve.run(f.bind())
      assert f.url == root_url + "/f"
      serve.shutdown()
      ray.shutdown()
  
imports: import logging
  import os
  import socket
  import sys
  import time
  import pytest
  import requests
  import ray
  import ray._private.gcs_utils
  from ray import serve
  from ray._private.services import new_port
  from ray._private.test_utils import convert_actor_state, run_string_as_driver, wait_for_condition
  from ray._raylet import GcsClient
  from ray.cluster_utils import Cluster, cluster_not_supported
  from ray.serve._private import api
  from ray.serve._private.constants import SERVE_CONTROLLER_NAME, SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE, SERVE_PROXY_NAME, SERVE_ROOT_URL_ENV_KEY
  from ray.serve._private.default_impl import create_cluster_node_info_cache
  from ray.serve._private.http_util import set_socket_reuse_port
  from ray.serve._private.utils import block_until_http_ready, format_actor_name
  from ray.serve.config import DeploymentMode, HTTPOptions, ProxyLocation
  from ray.serve.context import _get_global_client
  from ray.serve.exceptions import RayServeException
  from ray.serve.schema import ServeApplicationSchema, ServeDeploySchema
  from ray.tests.conftest import maybe_external_redis
  from ray.tests.conftest import ray_start_with_dashboard
  from ray.util.state import list_actors
label_desc: Use image node_id 12 for calling a global function with example usage: test_http_root_url(ray_shutdown) without return types