Questions tagged [caddyfile]

The term Caddyfile describes a text file that changes how an instance of the Caddy web server works.

Definition:

The Caddyfile is the configuration file of the web server.

It is similar in purpose to httpd.conf or nginx.conf.

The Caddyfile file can be named anything, but by default, Caddy will look for a file called Caddyfile in the current directory.

Example Usage:

example.com {
    root /www/example.com
}

sub.example.com {
    root /www/sub.example.com
    gzip
    log ../access.log
}

Important Links:

148 questions
16
votes
2 answers

Access a Caddy server by IP

I have a website with docker and I use caddy for production. This is my configuration on my Caddyfile mydomain.com { proxy / django:5000 { header_upstream Host {host} header_upstream X-Real-IP {remote} header_upstream…
Marcos Aguayo
  • 6,840
  • 8
  • 28
  • 61
15
votes
4 answers

Caddy - Setting HTTPS on local domain

I would like to add HTTPS to my local domain, however we can't do this on localhost. My website goes fine when I run with this Caddyfile localhost:2020 { bind {$ADDRESS} proxy / http://192.168.100.82:9000 { transparent } } But I would…
Alexi Coard
  • 7,106
  • 12
  • 38
  • 58
13
votes
2 answers

Caddy configuration for Wordpress multisite

I'm trying to setup a Wordpress website with multisite: example.com example.com/fr With the following Caddyfile: example.com:80 { redir https://www.example.com{uri} } www.example.com:80 { root /app/public gzip fastcgi /…
Samber
  • 153
  • 1
  • 8
12
votes
2 answers

Caddy - How to disable https only for one domain

I have a config file for Caddy v2 like in below: sentry.mydomain.ru { reverse_proxy sentry:9000 } tasks.mydomain.ru { reverse_proxy taiga-proxy:80 } ain.mydomain.ru { reverse_proxy ain-frontend:80 } Caddy makes https for every domain…
Konstantin
  • 123
  • 1
  • 1
  • 5
10
votes
3 answers

Caddy V2 IP whitelist

I am trying to implement IP whitelist on my Caddy v2 configuration. Something equivalent to NGINX configuration like: allow 1.1.1.1; allow 8.8.8.8; deny all; My current Caddy configuration pretty straight forward: my.website.com { …
Dikobraz
  • 649
  • 2
  • 8
  • 22
10
votes
3 answers

Specify Caddy listening port

"By default, Caddy will bind to ports 80 and 443 to serve HTTPS and redirect HTTP to HTTPS." (https://caddyserver.com/docs/automatic-https) How can we change this port? Background: In our setup, Caddy runs behind an AWS load balancer which forwards…
NtlX
  • 103
  • 1
  • 1
  • 4
9
votes
2 answers

Reverse Proxy for Web Sockets (WSS) using Caddy

Project GitHub URL I have just started using caddy. I have made a simple chat application which I am serving using caddy. The WebSockets are served on ws instead of wss by the application, similar to how the application is served on HTTP and not…
Shaurya Chaudhuri
  • 3,772
  • 6
  • 28
  • 58
8
votes
0 answers

Can Caddy V1 apply GZIP compression to a proxied response?

I'm running Caddy v1 as a reverse proxy and I would like to apply GZIP compression on e.g. JSON responses. I noticed that the gzip Caddy v1 directive only applies on files Caddy serves its self but not on responses where Caddy runs a reverse proxy…
saw303
  • 8,051
  • 7
  • 50
  • 90
5
votes
3 answers

How to use caddy as reverse proxy for local domain with https

Is it possible to use caddy for local development where you have https://mysite.loc and use Caddyfile as reverse proxy to your services running on localhost? My hosts file so I have local mysite.loc domain 127.0.0.1 mysite.loc mysite.loc { …
Hnus
  • 912
  • 2
  • 9
  • 24
4
votes
1 answer

Caddy reverse_proxy with websocket JSON config

I have this simple caddy JSON config to proxy request from https://localhost to my localhost server running on port 8080. That's working fine. { "apps": { "http": { "servers": { "localhost": { …
Stephane
  • 11,056
  • 9
  • 41
  • 51
4
votes
1 answer

What is Caddyfile file type?

I'm using PhpStorm to develop a project. I have created a Caddyfile to configure my caddy server. But PhpStorm doesn't format or highlight the code of the Caddyfile. I know that I can change the File Type for specific file but I don't know which…
Lenny4
  • 1,215
  • 1
  • 14
  • 33
4
votes
1 answer

Caddy not rendering assets

I have a rails application that is not rendering assets. It was previously working fine. When I added linked files it not only uploaded the files I specified but also precompiled assets. Even after clobbering all assets and recompiling it fails to…
Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188
4
votes
0 answers

Caddyfile set password securely

i have only started to use caddy and i am trying to figure out how to create an endpoint with a secure basicauth configured. given a configuration like this: test.my-domain.com { basicauth / testuser testpassword proxy /…
X0r0N
  • 1,816
  • 6
  • 29
  • 50
4
votes
1 answer

Caddy server:multiple proxies for same site

I'm using Caddy to revers proxy some sites on a DigitalOcean Ubuntu droplet. This is my Caddy file, pretty simple :upside_down: my-site.com { # projects proxy /projects/some-project localhost:8998 # main site proxy /…
Christian Gill
  • 514
  • 5
  • 21
3
votes
1 answer

Caddy reverse_proxy and React Router

I am unable to setup my Caddyfile to work with a React SPA app such that React router routes works Calls to /api/ (e.g. /api/foo) are reverse proxied to another location With my current Caddyfile below, React router appears to be working (visiting…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
1
2 3
9 10