Has anyone self hosting setup caddy to proxy to invoiceninja, i’m NOT using docker. That would probably be easier but i’m not switching it over. Just curious what the caddy entry looks like. Some apps i just have
reverse_proxy x.x.x.x:443
Others require more directives so it works properly. Trying to figure out what invoiceninja might need in the caddy file, i’ve already added the trust_proxies IP
hillel
February 17, 2024, 5:05pm
2
Hi,
Sorry, I don’t have experience with Caddy.
I found this post which includes a caddy file which may help.
opened 09:25PM - 26 Oct 20 UTC
closed 01:16AM - 05 Jan 21 UTC
I've tried to deploy invoiceninja 5 using the suggested docker-compose with a sl… ight modification since I already have a Caddy container running. After deploying the invoice ninja stack I joined the "app" to the caddy docker network for proper DNS resolution however I am getting a connection reset either when accessing the docker host IP:765 and when trying to access it from the external TLD.
docker-compose
```yml
version: '3.7'
services:
app:
image: invoiceninja/invoiceninja:5
restart: always
ports:
- '765:9000'
cap_add:
- SYS_ADMIN
environment:
- APP_DEBUG=1
- APP_URL=snip
- APP_KEY=snip
- MULTI_DB_ENABLED=false
- DB_HOST1=db
volumes:
- public:/var/www/app/public
- storage:/var/www/app/storage
depends_on:
- db
networks:
- net
db:
image: mysql:5
restart: always
environment:
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=ninja
volumes:
- mysql-data:/var/lib/mysql:rw
networks:
- net
volumes:
mysql-data:
public:
storage:
networks:
net:
ubuntu@docker:~$
```
Caddyfile:
```
TLD {
reverse_proxy invoiceninja5_app_1:9000
}
```
Invoice Ninja logs (notice that no incoming connection is shown, should at least log it?):
```
Configuration cache cleared!,
Configuration cached successfully!,
Configuration cache cleared!,
Configuration cached successfully!,
Route cache cleared!,
Routes cached successfully!,
les cached successfully!,
[23-Oct-2020 09:57:10] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root,
[23-Oct-2020 09:57:10] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root,
[23-Oct-2020 09:57:10] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root,
[23-Oct-2020 09:57:10] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root,
[23-Oct-2020 09:57:10] NOTICE: fpm is running, pid 1,
[23-Oct-2020 09:57:10] NOTICE: ready to handle connections,
```
Caddy logs:
```
{"remote_addr":"snip snip","proto":"HTTP/2.0","method":"GET","host":"snip snip TLD","uri":"/favicon.ico","headers":{"Accept":["image/webp,*/*"],"Accept-Language":["it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3"],"Accept-Encoding":["gzip, deflate, br"],"Dnt":["1"],"Referer":["snip snip"],"Sec-Gpc":["1"],"Te":["trailers"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"h2","proto_mutual":true,"server_name":"snip snip"}},"duration":0.001858917,"status":502,"err_id":"91vjvzwht","err_trace":"reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:441)"},
```
Just as a test I also tried to deploy the stack "as is" using the default docker-compose file, adding only the generated app key with the same results.