Question to the route directive example

(Maybe this should go into the category “site feedback”, idk)

From the docs we have this example:

route /api/* {
	uri strip_prefix /api
	reverse_proxy localhost:9000

route is used to keep the order of the directives.

I can read that uri comes before reverse_proxy anyways. So why is route used here?

Wouldn’t this do the same?

handle /api/* {
	uri strip_prefix /api
	reverse_proxy localhost:9000

(Which could be shortened to handle_path /api/* {reverse_proxy localhost:9000})

So, what am I missing about the route directive here, or is the example just … not well-chosen?

That example was written before handle_path was a thing, so yeah, I suppose it’s just a bad example.

If you’d like to propose a better one, you can find the site source here:

The example has nothing to do with the shortcut of handle_path ??
The handle_path was just a site-note to the handle directive.

The question is route vs. handle.

Unless you say the example was written before handle was a thing, your message is unrelated to my question. :thinking:

No, I mean that the example was somewhat more valid when handle_path didn’t exist. handle and route are basically interchangeable in this situation, since the mutual-exclusivity of handle and the directive order overriding of route don’t make a difference here (handle's mutual-exclusivity could matter, but not in this isolated example, on its own).

That answer is much different from your original one.
So, the example wasn’t well-chosen. As the special thing about route isn’t being used.

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