Importing snippets

Fair enough

I did as you suggested, but did have some issues. I commented out the things that were causing issues and now it works.

I need to serve files from 2 different places. Do you know how I can do this?

Here is my “working” Caddyfile atm

{
  # The Caddyfile is an easy way to configure your Caddy web server.
  #
  # Unless the file starts with a global options block, the first
  # uncommented line is always the address of your site.
  #
  # To use your own domain name (with automatic HTTPS), first make
  # sure your domain's A/AAAA DNS records are properly pointed to
  # this machine's public IP, then replace the line below with your
  # domain name.
  #:80
  
  # Set this path to your site's directory.
  #root * /opt/ivt/apps/6.0.0/packages/client/spa
  
  # Enable the static file server.
  #file_server * {
  #  root /opt/ivt/apps/6.0.0/packages/client/spa
  #}
  
  #file_server * {
  #  root /opt/ivt/photography
  #}
  
  # Another common task is to set up a reverse proxy:
  # reverse_proxy localhost:8080
  
  # Or serve a PHP site through php-fpm:
  # php_fastcgi localhost:9000
  
  # This is pointing to Let's Encrypt Staging environment (for dev)
  # https://letsencrypt.org/docs/staging-environment/
  # This will allow you to get things right before issuing trusted
  # certificates and reduce the chance of your running up against rate limits.
  acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
  
  # causes all certificates to be issued internally by default,
  # rather than through a (public) ACME CA such as Let's Encrypt.
  # This is useful in development environments.
  local_certs
  
  # configure automatic HTTPS. It can either disable it entirely (off)
  # or disable only HTTP-to-HTTPS redirects (disable_redirects).
  auto_https off
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

(header_options) {
  header_up X-Real-IP {remote_host}
  header_up X-Forwarded-Proto {scheme}
  header_up Access-Control-Allow-Origin *
  header_up Access-Control-Allow-Credentials true
  header_up Access-Control-Allow-Headers Cache-Control,Content-Type
}

localhost {
  route /weather/* {
    uri replace /weather /socket.io
    reverse_proxy * http://localhost:3010 {
      import header_options
    }
  }
  route /ptz/* {
    uri replace /ptz /socket.io
    reverse_proxy * http://localhost:3006 {
      import header_options
    }
  }
  route /liveview/* {
    uri replace /liveview /socket.io
    reverse_proxy * http://localhost:3004 {
      import header_options
    }
  }
  route /archive/* {
    uri replace /archive /socket.io
    reverse_proxy * http://localhost:3003 {
      import header_options
    }
  }
  route /alarms/* {
    uri replace /alarms /socket.io
    reverse_proxy * http://localhost:3002 {
      import header_options
    }
  }
  route /console_socket/* {
    uri replace /console_socket /console/socket.io
    reverse_proxy * http://localhost:3001 {
      import header_options
    }
  }
  route /web_app_socket/* {
    uri replace /web_app_socket /web/socket.io
    reverse_proxy * http://localhost:3001 {
      import header_options
    }
  }
  route /api/* {
    reverse_proxy * http://localhost:3001 {
      import header_options
    }
  }
}