Bug: named routes / invoke

Basically I have read the docs and wrote a config file accordingly;
Caddyfile - main

&(err-handler) {
	header Content-Type text/html
	respond "{err.status_code}"
}

&(html-gotool) {
	header Content-Type text/html
	respond <<HTML
	<html>
	<title>go.mod</title>
	<meta
	name="go-import"
	content="simpaix.net/simpa git https://github.com/SimpaiX-net/simpa"
	>
	</html>
	HTML 200
}

import confs/*

simpaix.net {
	@gotool {
		query go-get=*
	}

	handle @gotool {
		invoke html-gotool
	}

	handle /engine {
		redir https://github.com/SimpaiX-net/simpa
	}

	route * {
		file_server {
			root /var/www/simpaix.net
			index index.htm
			pass_thru
		}
	}

	route * {
		error 404
	}

	handle_errors {
		invoke err-handler
	}
}

however, it does not invoke the named routes, idunno why…

Solved
Look beneath if you want explanation and help about it:

Chaining file servers can be complicated to understand. The request URI path has to match files on the disk. If it does not then it wont work. For that reason using a rewrite works perfectly fine.

Doc: rewrite (Caddyfile directive) — Caddy Documentation
Because:
Basically so it means that after a rewrite directive following chaining other handlers in the same route as rewrite is, will get rid of the modificated req URI within that chained handler? But when embedded rewrite in a handle and the chains of handles in that specific block, it will?

{
	debug
}

(errhandler) {
	root * "/var/www/errors"
	templates
	file_server
}

(htmlgotool) {
	header Content-Type text/html
	respond <<HTML
	<html>
	<title>go.mod</title>
	<meta
	name="go-import"
	content="simpaix.net/simpa git https://github.com/SimpaiX-net/simpa"
	>
	</html>
	HTML 200
}

import confs/*



simpaix.net {
	@gotool {
		query go-get=*
	}

	handle @gotool {
		import htmlgotool
	}

	handle /engine {
		redir https://github.com/SimpaiX-net/simpa
	}

	route /* {
		file_server {
			root /var/www/simpaix.net
			index index.htm
		}
	}

	handle_errors {
		handle {
			rewrite * index.html
			import errhandler
		}
	}
}


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.