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
1
vote
0 answers

Caddy reverse proxy to multiple sites with docker, scalability

I'm trying to set-up a simple Caddy server on host machine to redirect multiple domains to multiple web servers hosted in Docker containers. This configuration tells Caddy to proxy all requests for each domain to a different Docker container running…
Filip Seman
  • 1,252
  • 2
  • 15
  • 22
1
vote
1 answer

Caddy 2 - Caddyfile - Getting ERR_SSL_PROTOCOL_ERROR

I've tried to setup a Caddy server, to handle auto SSL generating for my clients. But I keep getting errors, though sometimes it works, and I have no idea why. I'm new to Caddy, and could use some pointers to what to try next. Using: Ubuntu…
TheNish
  • 330
  • 3
  • 15
1
vote
0 answers

Forward Requests to a sub-domain via CaddyFile

I have a domain. Let's say test.com. I have to forward requests of a route of this domain to a subdomain and render response of the same without Changing URL via Caddy Server For Example, Request Flow: test.com/home -> Caddy ->…
Shobit Jain
  • 308
  • 2
  • 14
1
vote
1 answer

Redirect all undefined subdomains using Caddy

Let's say my Caddyfile defines two sites: a.example.com and b.example.com. What should I do so that any subdomain other than these two is redirected to a.example.com? For example, going to c.example.com or xyz.example.com should redirect to…
scaramouche
  • 461
  • 2
  • 12
1
vote
0 answers

Caddy: Use client cert in reverse_proxy for authentication

I am setting up a local dev environment in which I am proxying certain requests to a back-end server. When calling the back-end server directly, I get the below browser prompt for a local certificate for authentication. How can I do the same thing…
mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
1
vote
0 answers

Is it possible to loop over an array in a Caddyfile

I have a Caddyfile which I have a CORS function defined: (cors) { @origin{args.0} header Origin {args.0} header @origin{args.0} Access-Control-Allow-Origin "{args.0}" header @origin{args.0} Vary Origin } and then currently I…
Ray
  • 1,324
  • 10
  • 18
1
vote
2 answers

Generic domain part with fixed subdomain using Caddy and auto SSL?

I'd like to setup a Caddy server where the subdomain is static but the domain part is "wildcard", such as "api.*" From my understanding of Caddy, the wildcard is possible for one part of the full domain (*.domain.com matches bar.domain.com but not…
Cyril N.
  • 38,875
  • 36
  • 142
  • 243
1
vote
0 answers

404 error on Vue reload with Caddy; 'try_files {path} /' breaks API

I'm migrating to my own VPS with mongoDB after having used Firebase and Firebase hosting. When on example.com/example, refreshing the page results in a 404 error. Vue.js documentation says to include this in the caddy file: try_files {path} / This…
Joseph
  • 691
  • 4
  • 18
1
vote
1 answer

How to edit the Caddyfile with ECR

I am working with two containers, one is for Caddy and one is for my application, both of them have been hosted on ECS Fargate, while my application is being pulled from ECR and the caddy image is being pulled from the official Docker repository.…
not-up
  • 41
  • 3
1
vote
1 answer

Caddy reverse proxy, prioritize files, then reverse_proxy

I got trouble using Caddy v2, while in v1 I never have such trouble I want to prioritize: file_server if started with /upload/* reverse_proxy to 127.0.0.1:9090 if started with /api/* else reverse_proxy to 127.0.0.1:3000 But seems I cannot get it…
Kokizzu
  • 24,974
  • 37
  • 137
  • 233
1
vote
0 answers

mercure symfony and Caddy server not working

I have installed Caddy in my CentOS 7 then I have downloaded the latest mercure that uses Caddy. I tried to run mercure using the below command: /usr/bin/caddy run --environ --config Caddyfile. The Caddyfile has the following config: # Learn how to…
Dev Dev
  • 314
  • 4
  • 17
1
vote
0 answers

caddy: one server, 2 secure reverse proxies

I'd like to set up two secure reverse proxies on the same server with a single Caddyfile. The web server listens on port 8081, and the following successfully accepts outside connections on normal port 443 and directs them internally to 8081. #…
ExactaBox
  • 3,235
  • 16
  • 27
1
vote
1 answer

Caddy + dynamic filename for file_server

I'm trying to get Caddy server to display a file that is kind of dynamic (assigned to a variable). I find the official documentation a bit opaque and searching Internets doesn't return much info either. My example Caddyfile config: example.com { …
mlen108
  • 456
  • 1
  • 4
  • 12
1
vote
1 answer

Caddy: unrecognized directive: uri

Caddy gives me this error: run: adapting config using caddyfile: /etc/caddy/Caddyfile:21: unrecognized directive: uri My Caddyfile: { email localemail@example.com acme_ca https://acme-v02.api.letsencrypt.org/directory #acme_ca…
Gezim
  • 7,112
  • 10
  • 62
  • 98
1
vote
1 answer

Caddy handle subdirectory api

I am looking to convert nginx config file to caddy with multiple sub path api configs. server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; root /usr/local/var/www/example/ui; index index.html…
rajub
  • 320
  • 1
  • 5
  • 17