statusCode
Immediately terminates the request and returns the specified HTTP status code without forwarding the request to the backend server.
Rule Syntax
txt
pattern statusCode://value [filters...]
Parameters | Description | Detailed Documentation |
---|---|---|
pattern | Expression to match request URLs | Match Pattern Documentation |
value | Response status code, such as 200 /302 /404 , etc. | |
filters | Optional filters, supporting matching: • Request URL/Method/Headers/Content • Response status code/Headers | Filter Documentation |
Configuration Example
txt
# Visit `https://www.example.com/path/to` and the browser prompts for username and password.
www.example.com/path statusCode://401
# You can disable the login pop-up using disable / lineProps
www.example.com/path statusCode://401 disable://userLogin
Set the
statusCode
request. The response content is empty. You can customize the response content using resBody
Notes
statusCode://value
only takes effect during the request phase. Matching requests will not be forwarded to the backend server. To replace the statusCode
in the backend response, use the replaceStatus protocol.
Related Protocols
- Replace the response status code: replaceStatus
- Disable the login dialog: enable or lineProps
- Set the response content: resBody