# \[SOLVED\] Passing more options to the embedded Caddy server?

**URL:** <https://forum.pydio.com/t/solved-passing-more-options-to-the-embedded-caddy-server/2486>\
**Category:** Pydio Cells\
**Created:** [May 18, 2019, 1:04am UTC](https://forum.pydio.com/t/solved-passing-more-options-to-the-embedded-caddy-server/2486 "2019-05-18T01:04:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GwynethLlewelyn](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/gwynethllewelyn/32/2419_2.png) [@GwynethLlewelyn](https://forum.pydio.com/u/GwynethLlewelyn)\
**Post date:** [May 18, 2019, 1:04am UTC](https://forum.pydio.com/t/solved-passing-more-options-to-the-embedded-caddy-server/2486/1 "2019-05-18T01:04:33Z")

</div>

Hi there,

I’ve been taking a look at the code to try to understand how exactly options are being passed to the embedded Caddy server. This is because, although a ‘standard’ Caddy installation will _always_ reply with HTTP/2 (that’s the default), for some reason, Pydio Cells is answering with HTTP/1.1 (as far as I can test it). Because under Caddy HTTP/2 must be _explicitly_ turned off, I wonder if that’s what is being done — somewhere deep in the code — and, if so, is there a reason why?  
As far as I could understand the code reading the `pydio.json` configuration file (most of which under `github.com/pydio/cells/common/config`), it seems that the only options forwarded to the embedded Caddy server are those under `cert`, i.e.

```auto
        ssl := Get("cert", t, "ssl").Bool(false)
        selfSigned := Get("cert", t, "self").Bool(false)
        certFile := Get("cert", t, "certFile").String("")
        keyFile := Get("cert", t, "keyFile").String("")

```

Is there any (simple!) way to add further options to be passed along to Caddy? I understand that something like passing `alpn h2` [ought to do the trick](https://caddy.community/t/how-do-i-completely-disable-http1-requests-i-want-my-webserver-to-only-answer-http2-requests/2015/2/), i.e. preventing HTTP/1.1 connections to be established and solely rely on HTTP/2.

I understand that I could accomplish this by having a front-end for Cells (say, a separate Caddy, or `pound`, or `nginx`, or any of a gazillion reverse proxies that can be found…) but that misses the point… I want to take advantage of Cells’ built-in Caddy server!

---

<div class="post-metadata">

**Author:** ![GwynethLlewelyn](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/gwynethllewelyn/32/2419_2.png) [@GwynethLlewelyn](https://forum.pydio.com/u/GwynethLlewelyn)\
**Post date:** [May 18, 2019, 4:42pm UTC](https://forum.pydio.com/t/solved-passing-more-options-to-the-embedded-caddy-server/2486/2 "2019-05-18T16:42:32Z")

</div>

After a bit of careful digging, I found out a way to ‘fix’ this!

Under `gateway/proxy/plugins.go`, around line 191, inside `func init()` you’ll come across the following line:

```auto
httpserver.HTTP2 = false

```

Switching it to `true` and rebuilding Cells will most definitely get Caddy to reply with HTTP/2!

Now my next question is: why was HTTP2 support _deliberately_ disabled? I guess there might be a reason for that — maybe some internal parts of Cells will stop working? So far, as far as I can test things more or less thoroughly, things seem to be working… although with some console errors on the browser (but I can’t say if these weren’t already present!).

Perhaps there is a good reason why you cannot pass more options to Caddy… namely, those that have been hard-coded (such as lack of HTTP/2 support!) are known to _work_. Is that the reason?

---

<div class="post-metadata">

**Author:** ![charles](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/charles/32/3_2.png) [@charles](https://forum.pydio.com/u/charles)\
**Post date:** [May 20, 2019, 9:05am UTC](https://forum.pydio.com/t/solved-passing-more-options-to-the-embedded-caddy-server/2486/3 "2019-05-20T09:05:19Z")

</div>

Hi,  
I’ve been looking at that very recently: at one point we disabled HTTP2 **deliberately** because there was an issue with WebSockets support.  
But from what I read from the Caddy github issues (and you pointing to `alpn` instructions seems to indicate you looked at the same stuff), this should now be working, thanks to evolutions of the underlying net library of Go. Not thoroughly tested yet, but we’ll probably remove this line at one point.  
That said, I think it could be a great feature request to have the ability to declare additional caddy directives to be launched by the embedded server (without having to recompile everything).  
-c

---

<div class="post-metadata">

**Author:** ![GwynethLlewelyn](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/gwynethllewelyn/32/2419_2.png) [@GwynethLlewelyn](https://forum.pydio.com/u/GwynethLlewelyn)\
**Post date:** [May 22, 2019, 7:59pm UTC](https://forum.pydio.com/t/solved-passing-more-options-to-the-embedded-caddy-server/2486/4 "2019-05-22T19:59:58Z")

</div>

> [@charles](#):
>
> I think it could be a great feature request to have the ability to declare additional caddy directives to be launched by the embedded server (without having to recompile everything).

Sure, I’ll be happy to add that request on GiHub! 🙂
