Skip to content
On this page

返回响应 return

- search: _
  action: return
  redirect: 
    #返回参数

return可以直接返回一个响应,无视fetch状态,对接下来的规则也将不执行。

body

返回的响应的body是一个字符串:

- search: \/error$
  action: return
  redirect: 
    body: error

status

指定返回的状态码,默认是200。

- search: \/error599$
  action: return
  redirect: 
    body: error599
    status: 599

指定返回的header,应该是一个键值对。

- search: \/error$
  action: return
  redirect: 
    body: <h1>error</h1>
    header: 
      Content-Type: text/html
      X-Custom-Header: custom