Closed gedw99 closed 1 month ago
Your request went out to the IPv6 address [::1]. You could make sure you used http://localhost:8080 or change the host line in the config file to
http://localhost:8080, http://[::1]:8080 {
Hey @dbohdan
I tried changing that line, but same error.
# https://github.com/dbohdan/caddy-markdown-site
# Copyright (c) 2021 D. Bohdan. License: MIT.
http://localhost:8080, http://[::1]:8080 {
root * demo
encode gzip
file_server
templates
@media {
path /favicon.ico
path /media/*
}
@templates {
path /templates/*
not path /templates/*.css /templates/*.js
}
@markdown {
path_regexp \.md$
}
@markdown_exists {
file {path}.md
}
handle @media {
file_server
}
handle @templates {
error 403
}
handle @markdown {
rewrite * /templates/index.html
}
handle @markdown_exists {
map {path} {caddy_markdown_site.append_to_path} {
default extension
}
rewrite * /templates/index.html
}
handle_errors {
file_server
templates
@markdown_index_exists_404 {
file {path}/index.md
expression `{http.error.status_code} == 404`
}
handle @markdown_index_exists_404 {
map {path} {caddy_markdown_site.append_to_path} {
default index
}
file_server {
status 200
}
rewrite * /templates/index.html
}
handle {
rewrite * /templates/error.html
}
}
}
caddy run --config ./caddy_config_caddyfile --adapter caddyfile --watch
2024/09/06 10:00:08.923 INFO using config from file {"file": "/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/caddy/dbohdan__caddy-markdown-site/caddy_config_caddyfile"}
2024/09/06 10:00:08.926 INFO adapted config to JSON {"adapter": "caddyfile"}
2024/09/06 10:00:08.929 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2024/09/06 10:00:08.929 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0x1400033c500"}
2024/09/06 10:00:08.936 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2024/09/06 10:00:08.937 INFO autosaved config (load with --resume flag) {"file": "/Users/apple/Library/Application Support/Caddy/autosave.json"}
2024/09/06 10:00:08.937 INFO serving initial configuration
2024/09/06 10:00:08.938 INFO watcher watching config file for changes {"config_file": "/Users/apple/workspace/go/src/github.com/gedw99/kanka-cloudflare/modules/caddy/dbohdan__caddy-markdown-site/caddy_config_caddyfile"}
2024/09/06 10:00:08.941 INFO tls storage cleaning happened too recently; skipping for now {"storage": "FileStorage:/Users/apple/Library/Application Support/Caddy", "instance": "fd15b1ef-73ef-4a38-935a-0c756268fee7", "try_again": "2024/09/07 10:00:08.941", "try_again_in": 86399.999999834}
2024/09/06 10:00:08.941 INFO tls finished cleaning storage units
2024/09/06 10:00:15.140 ERROR http.log.error error handling handler error {"request": {"remote_ip": "::1", "remote_port": "56796", "client_ip": "::1", "proto": "HTTP/1.1", "method": "GET", "host": "localhost:8080", "uri": "/", "headers": {"Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Mode": ["navigate"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15"], "Sec-Fetch-Dest": ["document"], "Accept-Encoding": ["gzip, deflate"], "Sec-Fetch-Site": ["none"], "Connection": ["keep-alive"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"], "Accept-Language": ["en-GB,en;q=0.9"]}}, "duration": 0.002147166, "error": "{id=h3umw78cb} fileserver.(*FileServer).notFound (staticfiles.go:651): HTTP 404", "first_error": {"msg": "{id=23kksgein} fileserver.(*FileServer).notFound (staticfiles.go:651): HTTP 404", "status": 404, "err_id": "23kksgein", "err_trace": "fileserver.(*FileServer).notFound (staticfiles.go:651)"}}
^C2024/09/06 10:00:17.965 INFO shutting down {"signal": "SIGINT"}
2024/09/06 10:00:17.966 WARN exiting; byeee!! 👋 {"signal": "SIGINT"}
2024/09/06 10:00:17.966 INFO http servers shutting down with eternal grace period
2024/09/06 10:00:17.968 INFO admin stopped previous server {"address": "localhost:2019"}
2024/09/06 10:00:17.968 INFO shutdown complete {"signal": "SIGINT", "exit_code": 0}
make: *** [Makefile:54: this-caddy] Interrupt: 2
Not sure whats going on.
Oh, I misunderstood the initial error. Your client was apparently making the correct request to Caddy, just over IPv6.
Maybe it is a symlink resolution problem? It is hard for me to replicate this because I don't have a Mac. Try using the absolute physical path for the root. What I mean is, replace demo
in root * demo
with the output from running the shell command realpath demo
in demo
's parent directory.
Oh, I misunderstood the initial error. Your client was apparently making the correct request to Caddy, just over IPv6.
Maybe it is a symlink resolution problem? It is hard for me to replicate this because I don't have a Mac. Try using the absolute physical path for the root. What I mean is, replace
demo
inroot * demo
with the output from running the shell commandrealpath demo
indemo
's parent directory.
I got it working. Some issues with coping files.. User error :)
will close...
thanks for your patient on this...
Hey @dbohdan
When I run off your src code it works.
When I copied the demo and templates folder and your caddyfile to a new root it fails.
caddy_config_caddyfile