1. Caddy version (caddy version
):
v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=
2. How I run Caddy:
#!/bin/bash
/Users/jianfei/Documents/418-weBook/macOS-caddy/caddy_darwin_amd64 start -watch -config /Users/jianfei/Documents/418-weBook/macOS-caddy/caddy-macOS.conf -adapter caddyfile
a. System environment:
macOS 11.4
b. Command:
~/Documents/418-weBook/macOS-caddy/bin-runCaddy.sh
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
192.168.98.0:8020 {
# tls internal
encode gzip
# protocol http
# protocol https
log {
output file /Users/jianfei/Documents/418-weBook/log/access-20210709.log
}
root * /Users/jianfei/Documents/418-weBook/webook-tree
file_server browse {
root /Users/jianfei/Documents/418-weBook/webook-tree/
index index.html
}
# remote_ip 127.0.0.1 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8
# ipfilter /users {
# rule allow
# ip 192.168.98.0/24
# }
# index { index.html }
# try_files {/Users/jianfei/Documents/418-weBook/webook-tree/} {index}.html
}
3. The problem I’m having:
I have googled and tried many method, including remote_ip matchers, ip.filter, and etc, but I can’t find a way to grant access of the caddy server for both localhost and other LAN clients
4. Error messages and/or full log output:
…
|2021/07/18 07:13:26.651|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57933, proto: HTTP/1.1, method: GET, host: localhost:8020, uri: /videos/R.flv, headers: {Range: [bytes=0-], Accept: [/], Accept-Language: [en_US], User-Agent: [VLC/3.0.14 LibVLC/3.0.14]}, tls: {resumed: false, version: 771, cipher_suite: 49196, proto: , proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:13:26 +0800] \GET /videos/R.flv HTTP/1.1\ 206 19955712, duration: 16.814167673, size: 19955712, status: 206, resp_headers: {Server: [Caddy], Etag: [\qwdshwex3qr], Content-Type: [video/x-flv], Last-Modified: [Sat, 17 Jul 2021 08:49:08 GMT], Content-Range: [bytes 0-25059122/25059123], Accept-Ranges: [bytes], Content-Length: [25059123]}}|
|2021/07/18 07:13:53.239|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57589, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {X-Playback-Session-Id: [D8844D5C-5F0E-4023-9CF6-C284FBBED5FB], Range: [bytes=44498944-87856977], Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity], Accept: [/]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:13:53 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 43358034, duration: 0.072753967, size: 43358034, status: 206, resp_headers: {Content-Type: [video/mp4], Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 44498944-87856977/87856978], Accept-Ranges: [bytes], Content-Length: [43358034], Server: [Caddy], Etag: [\qveuvw1gb2vm]}}|
|2021/07/18 07:15:16.936|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57589, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {Accept: [/], X-Playback-Session-Id: [D8844D5C-5F0E-4023-9CF6-C284FBBED5FB], Range: [bytes=46596096-87856977], Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:15:16 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 41260882, duration: 0.064170537, size: 41260882, status: 206, resp_headers: {Server: [Caddy], Etag: [\qveuvw1gb2vm], Content-Type: [video/mp4], Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 46596096-87856977/87856978], Accept-Ranges: [bytes], Content-Length: [41260882]}}|
|2021/07/18 07:16:26.835|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57589, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {Accept: [/], X-Playback-Session-Id: [D8844D5C-5F0E-4023-9CF6-C284FBBED5FB], Range: [bytes=48693248-87856977], Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:16:26 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 39163730, duration: 0.054180567, size: 39163730, status: 206, resp_headers: {Etag: [\qveuvw1gb2vm], Content-Type: [video/mp4], Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 48693248-87856977/87856978], Accept-Ranges: [bytes], Content-Length: [39163730], Server: [Caddy]}}|
|2021/07/18 07:17:08.292|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57589, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {X-Playback-Session-Id: [D8844D5C-5F0E-4023-9CF6-C284FBBED5FB], Range: [bytes=50790400-87856977], Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity], Accept: [/]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:17:08 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 37066578, duration: 0.0573174, size: 37066578, status: 206, resp_headers: {Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 50790400-87856977/87856978], Accept-Ranges: [bytes], Content-Length: [37066578], Server: [Caddy], Etag: [\qveuvw1gb2vm], Content-Type: [video/mp4]}}|
|2021/07/18 07:17:35.035|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57589, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {Accept-Encoding: [identity], Accept: [/], X-Playback-Session-Id: [D8844D5C-5F0E-4023-9CF6-C284FBBED5FB], Range: [bytes=52887552-87856977], Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:17:35 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 34969426, duration: 0.053731216, size: 34969426, status: 206, resp_headers: {Content-Length: [34969426], Server: [Caddy], Etag: [\qveuvw1gb2vm], Content-Type: [video/mp4], Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 52887552-87856977/87856978], Accept-Ranges: [bytes]}}|
|2021/07/18 07:18:09.938|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:57589, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity], Accept: [/], X-Playback-Session-Id: [D8844D5C-5F0E-4023-9CF6-C284FBBED5FB], Range: [bytes=54984704-87856977]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:18:09 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 32872274, duration: 0.048506637, size: 32872274, status: 206, resp_headers: {Content-Type: [video/mp4], Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 54984704-87856977/87856978], Accept-Ranges: [bytes], Content-Length: [32872274], Server: [Caddy], Etag: [\qveuvw1gb2vm]}}|
|2021/07/18 07:22:01.493|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:58048, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /chap0005_readMe.html, headers: {Accept-Encoding: [gzip, deflate, br], Accept: [text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8], If-None-Match: [\qwfifxjq], If-Modified-Since: [Sun, 18 Jul 2021 07:07:09 GMT], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Accept-Language: [en-us]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:22:01 +0800] \GET /chap0005_readMe.html HTTP/2.0\ 304 0, duration: 0.002725345, size: 0, status: 304, resp_headers: {Etag: [\qwfifxjq], Server: [Caddy]}}|
|2021/07/18 07:22:01.496|error|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:58048, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /js/scripts.js, headers: {Referer: [https://localhost:8020/chap0005_readMe.html], Accept: [/], Accept-Encoding: [gzip, deflate, br], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Accept-Language: [en-us]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:22:01 +0800] \GET /js/scripts.js HTTP/2.0\ 404 0, duration: 0.000101535, size: 0, status: 404, resp_headers: {Server: [Caddy]}}|
|2021/07/18 07:22:01.496|error|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:58048, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /css/main.css, headers: {User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Accept-Language: [en-us], Referer: [https://localhost:8020/chap0005_readMe.html], Accept: [text/css,/;q=0.1], Accept-Encoding: [gzip, deflate, br]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:22:01 +0800] \GET /css/main.css HTTP/2.0\ 404 0, duration: 0.000125276, size: 0, status: 404, resp_headers: {Server: [Caddy]}}|
|2021/07/18 07:22:01.592|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:58048, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity], Accept: [/], X-Playback-Session-Id: [5DA0CF4D-6C94-4F86-A677-B8AF13665874], Range: [bytes=0-1], Accept-Language: [en-us]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:22:01 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 2, duration: 0.000186961, size: 2, status: 206, resp_headers: {Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 0-1/87856978], Accept-Ranges: [bytes], Content-Length: [2], Server: [Caddy], Etag: [\qveuvw1gb2vm], Content-Type: [video/mp4]}}|
|2021/07/18 07:22:01.753|info|http.log.access.log0|handled request|{request: {remote_addr: 127.0.0.1:58048, proto: HTTP/2.0, method: GET, host: localhost:8020, uri: /videos/S.mp4, headers: {Accept: [/], X-Playback-Session-Id: [5DA0CF4D-6C94-4F86-A677-B8AF13665874], Range: [bytes=0-87856977], Accept-Language: [en-us], User-Agent: [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15], Referer: [https://localhost:8020/chap0005_readMe.html], Accept-Encoding: [identity]}, tls: {resumed: false, version: 772, cipher_suite: 4865, proto: h2, proto_mutual: true, server_name: localhost}}, common_log: 127.0.0.1 - - [18/Jul/2021:15:22:01 +0800] \GET /videos/S.mp4 HTTP/2.0\ 206 87856978, duration: 0.157525698, size: 87856978, status: 206, resp_headers: {Last-Modified: [Mon, 28 Jun 2021 12:04:44 GMT], Content-Range: [bytes 0-87856977/87856978], Accept-Ranges: [bytes], Content-Length: [87856978], Server: [Caddy], Etag: [\qveuvw1gb2vm], Content-Type: [video/mp4]}}|
|2021/07/18 07:29:15.508|error|http.log.access.log0|handled request|{request: {remote_addr: 192.168.98.105:53933, proto: HTTP/1.1, method: GET, host: 192.168.98.104:8020, uri: /R.flv, headers: {User-Agent: [mpv 0.29.1-dirty], Accept: [/], Range: [bytes=0-], Connection: [close], Icy-Metadata: [1]}, tls: {resumed: false, version: 771, cipher_suite: 49196, proto: , proto_mutual: true, server_name: }}, common_log: 192.168.98.105 - - [18/Jul/2021:15:29:15 +0800] \GET /R.flv HTTP/1.1\ 404 0, duration: 0.000119835, size: 0, status: 404, resp_headers: {Server: [Caddy]}}|
|2021/07/18 07:30:53.734|info|http.log.access.log0|handled request|{request: {remote_addr: 192.168.98.105:53935, proto: HTTP/1.1, method: GET, host: 192.168.98.104:8020, uri: /videos/R.flv, headers: {Icy-Metadata: [1], User-Agent: [mpv 0.29.1-dirty], Accept: [/], Range: [bytes=0-], Connection: [close]}, tls: {resumed: false, version: 771, cipher_suite: 49196, proto: , proto_mutual: true, server_name: }}, common_log: 192.168.98.105 - - [18/Jul/2021:15:30:53 +0800] \GET /videos/R.flv HTTP/1.1\ 206 24870912, duration: 60.347138018, size: 24870912, status: 206, resp_headers: {Last-Modified: [Sat, 17 Jul 2021 08:49:08 GMT], Content-Range: [bytes 0-25059122/25059123], Accept-Ranges: [bytes], Content-Length: [25059123], Server: [Caddy], Etag: [\qwdshwex3qr], Content-Type: [video/x-flv]}}|
5. What I already tried:
I have tried to edit the localhost:80 to
http://*:8020
*:8020
:8020
but no ways worked.