- h2jammy.yushei.net
- Caddyfile
http://h2jammy.yushei.net:43889 {
reverse_proxy http://orangepi5.yushei.net:43888
log {
output file access.log
}
}
- orangepi5.yushei.net
- Caddyfile.simple
http://orangepi5.yushei.net:43888 {
file_server
respond "from orangepi5.yushei.net:43888"
log {
output file access.log
}
}
- Using
caddy run
from the same directory housing Caddyfile
- h2jammy.yushei.net
alexlai@h2Jammy:~/build/caddy-test$ caddy run
2023/07/02 12:33:50.137 INFO using adjacent Caddyfile
2023/07/02 12:33:50.138 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "Caddyfile", "line": 2}
2023/07/02 12:33:50.139 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//[::1]:2019", "//127.0.0.1:2019", "//localhost:2019"]}
2023/07/02 12:33:50.141 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000738230"}
2023/07/02 12:33:50.141 INFO tls cleaning storage unit {"description": "FileStorage:/home/alexlai/.local/share/caddy"}
2023/07/02 12:33:50.141 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2023/07/02 12:33:50.142 INFO tls finished cleaning storage units
2023/07/02 12:33:50.142 INFO autosaved config (load with --resume fla
[alexlai@orangepi5 ~]$ cd build/caddy-test/
[alexlai@orangepi5 caddy-test]$ caddy run --config Caddyfile.simple
2023/07/02 12:35:35.473 INFO using provided configuration {"config_file": "Caddyfile.simple", "config_adapter": ""}
2023/07/02 12:35:35.475 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "Caddyfile.simple", "line": 2}
2023/07/02 12:35:35.479 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2023/07/02 12:35:35.479 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2023/07/02 12:35:35.480 INFO tls cleaning storage unit {"description": "FileStorage:/opt/xfs/home/alexlai/.local/share/caddy"}
2023/07/02 12:35:35.480 INFO tls finished cleaning storage units
2023/07/02 12:35:35.480 INFO autosaved config (load with --resume flag) {"file": "/opt/xfs/home/alexlai/.local/share/caddy/autosave.json"}
2023/07/02 12:35:35.480 INFO serving initial configuration
2023/07/02 12:35:35.480 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0x40001d7490"}
- Reslut refresh http://orangepi5.yushei.net:43888, will responded "from orangepi5.yushei.net:43888"
- access.log
2023/07/02 12:43:52.478 info http.log.access.log0 handled request {"request": {"remote_ip": "192.168.48.241", "remote_port": "40148", "proto": "HTTP/1.1", "method": "GET", "host": "orangepi5.yushei.net:43888", "uri": "/", "headers": {"Connection": ["keep-alive"], "Cache-Control": ["max-age=0"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"], "Accept-Encoding": ["gzip, deflate"], "Upgrade-Insecure-Requests": ["1"], "User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Accept-Language": ["en-US,en;q=0.9"]}}, "user_id": "", "duration": 0.000041416, "size": 31, "status": 200, "resp_headers": {"Server": ["Caddy"], "Content-Type": ["text/plain; charset=utf-8"]}}
- refresh http://h2jammy.yushei.net:43889, get nothing back
- access.log
```
2023/07/02 12:44:43.779 info http.log.access.log0 handled request {"request": {"remote_ip": "114.33.29.69", "remote_port": "34172", "proto": "HTTP/1.1", "method": "GET", "host": "h2jammy.yushei.net:43889", "uri": "/", "headers": {"Connection": ["keep-alive"], "Cache-Control": ["max-age=0"], "Accept-Encoding": ["gzip, deflate"], "Accept-Language": ["en-US,en;q=0.9"], "Upgrade-Insecure-Requests": ["1"], "User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"]}}, "user_id": "", "duration": 0.23613514, "size": 0, "status": 200, "resp_headers": {"Content-Length": ["0"], "Server": ["Caddy", "Caddy"], "Date": ["Sun, 02 Jul 2023 12:44:43 GMT"]}}
2023/07/02 12:44:43.856 info http.log.access.log0 handled request {"request": {"remote_ip": "114.33.29.69", "remote_port": "34172", "proto": "HTTP/1.1", "method": "GET", "host": "h2jammy.yushei.net:43889", "uri": "/favicon.ico", "headers": {"Connection": ["keep-alive"], "User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Accept": ["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"], "Referer": ["http://h2jammy.yushei.net:43889/"], "Accept-Encoding": ["gzip, deflate"], "Accept-Language": ["en-US,en;q=0.9"]}}, "user_id": "", "duration": 0.005942991, "size": 0, "status": 200, "resp_headers": {"Server": ["Caddy", "Caddy"], "Date": ["Sun, 02 Jul 2023 12:44:43 GMT"], "Content-Length": ["0"]}}
and these do apperars on orangepi5.yushei.net, caddy run --config Caddyfile.simple
2023/07/02 12:44:43.760 INFO http.log.access handled request {"request": {"remote_ip": "192.168.11.248", "remote_port": "54458", "proto": "HTTP/1.1", "method": "GET", "host": "h2jammy.yushei.net:43889", "uri": "/", "headers": {"User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Accept-Encoding": ["gzip, deflate"], "Upgrade-Insecure-Requests": ["1"], "X-Forwarded-Proto": ["http"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"], "Accept-Language": ["en-US,en;q=0.9"], "Cache-Control": ["max-age=0"], "X-Forwarded-For": ["114.33.29.69"], "X-Forwarded-Host": ["h2jammy.yushei.net:43889"]}}, "user_id": "", "duration": 0.000009333, "size": 0, "status": 0, "resp_headers": {"Server": ["Caddy"]}}
2023/07/02 12:44:43.838 INFO http.log.access handled request {"request": {"remote_ip": "192.168.11.248", "remote_port": "54458", "proto": "HTTP/1.1", "method": "GET", "host": "h2jammy.yushei.net:43889", "uri": "/favicon.ico", "headers": {"User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"], "Accept-Language": ["en-US,en;q=0.9"], "X-Forwarded-Host": ["h2jammy.yushei.net:43889"], "X-Forwarded-Proto": ["http"], "Accept": ["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"], "Accept-Encoding": ["gzip, deflate"], "Referer": ["http://h2jammy.yushei.net:43889/"], "X-Forwarded-For": ["114.33.29.69"]}}, "user_id": "", "duration": 0.000009916, "size": 0, "status": 0, "resp_headers": {"Server": ["Caddy"]}}