forked from biblioverse/biblioteca
-
Notifications
You must be signed in to change notification settings - Fork 0
# Caddy Setup
Laurent Constantin edited this page Aug 17, 2024
·
1 revision
Run this project locally (Let's say on port 8083
)
On your CaddyFile
set the config as below:
books.example.com {
tls <email>
reverse_proxy localhost:8083 {
header_up X-Scheme {scheme}
}
}
- Configure your endpoint in your kobo to be different, let's say
api_endpoint=https://books-proxy.example.com
and restart your Kobo. - Save the mitmproxy script from below:
URL=${1:-https://storeapi.kobo.com}
docker run --rm -it -p 8555:8080 -p 8666:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0 --mode reverse:$URL
- Then setup Caddy as is:
books-proxy.example.com {
tls <email>
reverse_proxy http://192.168.1.200:8555 {
header_down Host
header_up X-Scheme https
header_up Host "storeapi.kobo.com"
header_down X-Forwarded-Proto
header_down X-Forwarded-Host
header_down X-Forwarded-For
}
}
- Restart Caddy
-
Run the mitmproxy script above with your local env endpoint
./run.sh https://books.example.com
-
Edit your Caddy configuration
books-proxy.example.com
as below, givenxxxxx
is your KoboDevice access key.
books-proxy.example.com {
tls <email>
rewrite * /kobo/xxxxx{uri}
reverse_proxy http://192.168.1.200:8555 {
header_down Host
header_up X-Scheme https
header_up Host "{upstream_hostport}"
header_down X-Forwarded-Proto
header_down X-Forwarded-Host
header_down X-Forwarded-For
}
}
- Restart Caddy