Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Cors directive/plugin being ignored  #13

@hydrosIII

Description

@hydrosIII

1. What version of Caddy are you using (caddy -version)?

Caddy 0.10.10

2. What are you trying to do?

Enable cors for a file in my site. Using the cors plugin

3. What is your entire Caddyfile?


mysite.org {
tls [email protected]
root /srv
cors /config.json  {
		origin *
		methods GET,POST,OPTIONS
		allowed_headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
		exposed_headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
		}

}

subsite.org {
tls myemail
proxy / 192.168.34.56
}

4. How did you run Caddy (give the full command and describe the execution environment)?

caddy --conf /root/.caddy/Caddyfile --log stdout

5. Please paste any relevant HTTP request(s) here.

curl -vvv https://mapa.rutasdelamemoria.org/config.json

6. What did you expect to see?

Using another site as reference i expected something like :

* TCP_NODELAY set
* Connected to sandbox.uchaguzi.or.ke (23.253.46.148) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=sandbox.uchaguzi.or.ke
*  start date: Oct  5 17:19:23 2017 GMT
*  expire date: Jan  3 17:19:23 2018 GMT
*  subjectAltName: host "sandbox.uchaguzi.or.ke" matched cert's "sandbox.uchaguzi.or.ke"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
> GET /config.json HTTP/1.1
> Host: sandbox.uchaguzi.or.ke
> User-Agent: curl/7.55.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.4.6 (Ubuntu)
< Date: Mon, 13 Nov 2017 15:06:26 GMT
< Content-Type: application/json
< Content-Length: 332
< Last-Modified: Tue, 31 Oct 2017 15:36:29 GMT
< Connection: keep-alive
< ETag: "59f8987d-14c"
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, OPTIONS
< Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
< Access-Control-Expose-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range
< Accept-Ranges: bytes
< 

7. What did you see instead (give full error messages and/or log)?

* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=mapa.rutasdelamemoria.org
*  start date: Oct 26 00:27:46 2017 GMT
*  expire date: Jan 24 00:27:46 2018 GMT
*  subjectAltName: host "mapa.rutasdelamemoria.org" matched cert's "mapa.rutasdelamemoria.org"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55db30d1ac10)
> GET /config.json HTTP/2
> Host: mapa.rutasdelamemoria.org
> User-Agent: curl/7.55.1
> Accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200 
< accept-ranges: bytes
< content-type: text/plain; charset=utf-8
< etag: "ozcxw0cr"
< last-modified: Mon, 13 Nov 2017 13:09:36 GMT
< server: Caddy
< content-length: 459
< date: Mon, 13 Nov 2017 15:05:54 GMT
< 

No error logs generated by Caddy.

8. How can someone who is starting from scratch reproduce the bug as minimally as possible?

Run Caddy 0.10.10 with cors directive, and multiple site in 1 conf file. Not sure if the problem is the mulsite conf.

Using docker container for caddy : abiosoft/caddy:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions