Skip to content

Instantly share code, notes, and snippets.

@monochromer
Last active October 26, 2023 11:08
Show Gist options
  • Save monochromer/5f50a30067489cda8bacafd8b60aca54 to your computer and use it in GitHub Desktop.
Save monochromer/5f50a30067489cda8bacafd8b60aca54 to your computer and use it in GitHub Desktop.
Caddy Server and Nginx. Get output of reverse proxy if static file not found
http://localhost:8080 {
root * ./public
@notStatic {
not {
file {
try_files {path} {path}/
}
}
}
# or short check.
#@notStatic not file
# serve the app if there's not a static file.
reverse_proxy @notStatic http://localhost:9000
# Serve the static file otherwise.
file_server
}
location / {
try_files $uri $uri/ @backend;
}
location @backend {
proxy_pass http://localhost:3000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment