# config for Caddy v2

:80 

route /data/uploads/* {
  
  root * /frontend/

  # fallback to index (for single page site)
  try_files {path} 

  # serve static files
  file_server 
}

route * {
  
  # backend proxying
  reverse_proxy web:4000 

}

# options
encode gzip
log
handle_errors {
	@502 expression `{http.error.status_code} == 502`
	handle @502 {
    respond 503 {
      body "Hello, unfortunately this instance seems to be down. Please try again in a few minutes!"
      close
    }
	}
}

