Skip to content

Commit

Permalink
update for caddy v2
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyinstarlight committed Sep 6, 2020
1 parent 938f683 commit b3922a8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
2 changes: 1 addition & 1 deletion carillon
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ components = {
'http': {
'name': 'web server',
'pre': caddy_generate,
'cmd': [config['http']['command_caddy'], '-conf', 'run/Caddyfile'],
'cmd': [config['http']['command_caddy'], 'run', '--config', 'run/Caddyfile'],
'cwd': None,
'log': 'log/http.out',
},
Expand Down
45 changes: 30 additions & 15 deletions conf/Caddyfile.in
Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
(radio) {
tls %TLS%
{
admin off
auto_https off
}

(radio) {
root www

log / stdout "{combined}"
log {
output stdout
format single_field combined_log
}

file_server

header /stream/stream. Cache-Control "public, max-age=12"
header /stream/stream.m3u8 Cache-Control "no-cache"
header /stream/metadata.json Cache-Control "no-cache"
header /stream/stream.m3u8 Cache-Control "no-cache"
header /stream/stream.*.ts Cache-Control "public, max-age=12"

gzip {
not /stream
@static {
not path /stream/*
}

encode @static gzip
%%TLS_BEGIN%%

redir 301 {
if {scheme} is http
/ https://%HOST%%OPTIONAL_HTTPS_PORT%{uri}
@http {
protocol http
}

redir @http https://localhost:8443{uri} permanent
%%TLS_END%%
%%UPDATE_BEGIN%%

proxy %UPDATER_BASE% http://%UPDATER_BIND%:%UPDATER_PORT% {
transparent
@ipfilter {
not remote_ip %ALLOW_UPDATE%
}

ipfilter %UPDATER_BASE% {
rule allow
ip %ALLOW_UPDATE%
route %UPDATER_BASE%/* {
respond @ipfilter 403
reverse_proxy http://%UPDATER_BIND%:%UPDATER_PORT%
}

redir %UPDATER_BASE% %UPDATER_BASE%/ permanent
%%UPDATE_END%%
}

Expand All @@ -42,6 +55,8 @@ http://%HOST%%OPTIONAL_HTTP_PORT% {
https://%HOST%%OPTIONAL_HTTPS_PORT% {
bind %BIND%

tls %TLS%

import radio
}
%%TLS_END%%
8 changes: 4 additions & 4 deletions conf/default.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[http]
command_caddy=caddy
bind=127.0.0.1
bind=::1
http_port=8000
https_port=8443
host=localhost
tls=off
allow_update=127.0.0.1
allow_update=::1

[ffmpeg]
command_ffmpeg=ffmpeg
Expand All @@ -14,7 +14,7 @@ device=default

[updater]
command_npm=npm
bind=127.0.0.1
bind=::1
port=4300
base=/update
proxy=127.0.0.1
proxy=::1

0 comments on commit b3922a8

Please sign in to comment.