V2: Unrecognized directive not

Hey,

When I try this

matcher notStatic {
    not {
		file {
			try_files {path}
		}
	}
}

I get this: unrecognized directive: not

Is that how it should be?

Hi Wayne, can you open a new thread and put your full Caddyfile and Caddy version? Thanks!

Edit: Aha! I learned a new trick, apparently we can splice replies out into new topics. That’s cool…

Anyway, can you still post your full Caddyfile and exact Caddy version? (Lots of changes have happened lately.)

Considering the timing, Matt, might it be because of the latest Caddyfile changes on the v2 branch?

New syntax would likely look like this:

@notStatic {
    not {
        file {
            try_files {path}
        }
    }
}
try_files @notStatic /something.txt

That said, the full Caddyfile would help. Maybe you nested this matcher inside another directive where it shouldn’t be?

This seems to work correctly - at least, it doesn’t complain about failures :slight_smile:

I ended out not actually needing that behavior, though, but here’s my sample config that worked:

:2015 {                                                               
    root * /tmp/blarpish

    @notFun {
        not {
            file {
                try_files {path}
            }
        }
    }

    reverse_proxy @notFun localhost:8000

    file_server 
}
1 Like

Thanks for the update!

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