Skip to content

reqCors

Sets the Cross-Origin Resource Sharing (CORS) header for the request to resolve cross-origin request issues.

Rule Syntax

txt
pattern resCors://value [filters...]
ParametersDescriptionDetailed Documentation
patternExpression to match request URLsMatch Pattern Documentation
valueCORS object, supported from the following sources:
• Directory/File Path
• Remote URL
• Inline/Embedded/Values Content
Operation Instruction Documentation
filtersOptional filters, supported for matching:
• Request URL/Method/Header/Content
• Response Status Code/Header
Filter Documentation

Configuration Example

Quick Mode

txt
www.example.com/path reqCors://*

Set the request header origin: *

Detailed Configuration Mode

txt
``` cors.json
origin: *
method: POST
headers: x-test
```
www.example.com/path reqCors://{cors.json}

Setting Request Headers:

txt
origin: *
access-control-request-method: POST
access-control-request-headers: x-test

Local/Remote Resources

txt
www.example.com/path1 reqCors:///User/xxx/test.json
www.example.com/path2 reqCors://https://www.xxx.com/xxx/params.json
# Editing a Temporary File
www.example.com/path3 reqCors://temp/blank.json

Associated Protocols

  1. Delete request headers: delete://reqHeaders.orogin
  2. Set the response cross-correspondence: resCors