Is it possible to change the response code for errors?

With nginx it can be done like this

Furthermore, it is possible to change the response code to another using the “=response” syntax, for example:
error_page 404 =200 /empty.gif;

Is there a way to do it with caddy?

Just to make sure I understand, you want to serve a 404 page with a status of 200? :confused:

Actually i need a setup where every non-existent (app-)route is mapped to root/index and this might be the most simple way …

Like what rewrite does?

rewrite {
   to {path} /

If the file at {path} doesn’t exist, it will route the request to root.

Thanks, but i also use the proxy.
proxy /api/db/ localhost:3000 { without /api/db/ }
With rewrite i would have to exclude all those proxy entries somehow. Is this right?
With the “special” 404 this would not be necessary.

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