code: def configure_cors_middleware(app):
      from starlette.middleware.cors import CORSMiddleware
      from modules.shared_cmd_options import cmd_opts
  
      cors_options = {
          "allow_methods": ["*"],
          "allow_headers": ["*"],
          "allow_credentials": True,
      }
      if cmd_opts.cors_allow_origins:
          cors_options[
              "allow_origins"
          ] = cmd_opts.cors_allow_origins.split(",")
      if cmd_opts.cors_allow_origins_regex:
          cors_options[
              "allow_origin_regex"
          ] = cmd_opts.cors_allow_origins_regex
      app.add_middleware(CORSMiddleware, **cors_options)
  
file_path: stable-diffusion-webui/modules/initialize_util.py
imports: import json
  import os
  import signal
  import sys
  import re
  from modules.timer import startup_timer
label_desc: Use image node_id 11 for calling a global function with example usage: configure_cors_middleware(app) without return types