Skip to content

Instantly share code, notes, and snippets.

@vy-let
Created November 26, 2018 00:01
Show Gist options
  • Save vy-let/0fc8e7a77c2adb2f803431cfdf88c754 to your computer and use it in GitHub Desktop.
Save vy-let/0fc8e7a77c2adb2f803431cfdf88c754 to your computer and use it in GitHub Desktop.
masto.example.com {
root /path/to/your/mastodon/public
gzip
rewrite {
if {path} is /
to /proxy/{uri}
}
rewrite {
to {path} /proxy/{uri}
}
proxy /proxy localhost:3000 {
except /proxy/api/v1/streaming
without /proxy
transparent
}
proxy /proxy/api/v1/streaming 127.0.0.1:4000 {
without /proxy
transparent
websocket
}
}
@vy-let
Copy link
Author

vy-let commented Nov 26, 2018

Assumes you're running the web and streaming servers on the same machine as caddy. The only two snippets you'll need to update to make this work are

  1. Your FQDN on line 1 instead of masto.example.com
  2. The path to the public directory inside your mastodon project, on line 2 after the root directive.

Note that this does work even if your firewall blocks 3000 and 4000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment