unknown module: layer4.handlers.file_server
crapthings opened this issue · 2 comments
crapthings commented
is there a file_server example?
{"level":"info","ts":1683883168.1252644,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc000367d50"}
Error: loading initial config: loading new config: loading layer4 app module: provision layer4: server 'main': route 3: position 1: loading module 'file_server': unknown module: layer4.handlers.file_server
- match:
- tls:
sni:
- "www.example.com"
handle:
- handler: tls
connection_policies:
- alpn: ["http/1.1"]
- handler: file_server
root: "/www/wwwroot/www.example.com"
francislavoie commented
file_server
is part of the http
app, not layer4
. There's no file_server
in layer4
. You'll need to use proxy
to pass the connection to the http
app which can then handle it.
crapthings commented
{
"apps": {
"tls": {
"automation": {
"policies": [
{
"issuers": [
{
"module": "acme",
"ca": "https://acme-staging-v02.api.letsencrypt.org/directory"
}
]
}
]
}
},
"http": {
"servers": {
"test1": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"test1.example.com"
]
}
],
"handle": [
{
"handler": "file_server",
"root": "/root/server/test1"
}
]
},
{
"match": [
{
"host": [
"test2.example.com"
]
}
],
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "127.0.0.1:2015"
}
]
}
]
}
]
},
"example": {
"listen": [":2015"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "Hello, world!"
}]
}
]
}
}
}
}
}
---
apps:
tls:
automation:
policies:
- issuers:
- module: acme
ca: https://acme-staging-v02.api.letsencrypt.org/directory
http:
servers:
test1:
listen:
- ":443"
routes:
- match:
- host:
- test1.example.com
handle:
- handler: file_server
root: "/root/server/test1"
- match:
- host:
- test2.example.com
handle:
- handler: reverse_proxy
upstreams:
- dial: 127.0.0.1:2015
example:
listen:
- ":2015"
routes:
- handle:
- handler: static_response
body: Hello, world!