Edit

Share via


devproxyrc

Default Dev Proxy configuration file.

Dev Proxy supports both JSON (.json) and YAML (.yaml, .yml) formats for configuration files. The default file is devproxyrc.json, but Dev Proxy also auto-discovers devproxyrc.yaml and devproxyrc.yml.

Note

Schema validation (validateSchemas) only applies to JSON-based configuration files. YAML configuration files are not validated against schemas at runtime.

File: devproxyrc.json

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "RetryAfterPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    },
    {
      "name": "GenericRandomErrorPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "genericRandomErrorPlugin"
    }
  ],
  "urlsToWatch": [
    "https://jsonplaceholder.typicode.com/*"
  ],
  "genericRandomErrorPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/genericrandomerrorplugin.schema.json",
    "errorsFile": "devproxy-errors.json",
    "rate": 50
  },
  "logLevel": "information",
  "newVersionNotification": "stable",
  "showSkipMessages": true,
  "showTimestamps": true,
  "validateSchemas": true
}

File: devproxyrc.yaml (equivalent YAML configuration)

plugins:
  - name: RetryAfterPlugin
    enabled: true
    pluginPath: "~appFolder/plugins/DevProxy.Plugins.dll"
  - name: GenericRandomErrorPlugin
    enabled: true
    pluginPath: "~appFolder/plugins/DevProxy.Plugins.dll"
    configSection: genericRandomErrorPlugin

urlsToWatch:
  - "https://jsonplaceholder.typicode.com/*"

genericRandomErrorPlugin:
  errorsFile: devproxy-errors.json
  rate: 50

logLevel: information
newVersionNotification: stable
showSkipMessages: true
showTimestamps: true
validateSchemas: true

YAML configuration supports anchors and merge keys for reusable configuration blocks:

definitions:
  throttled: &throttled
    statusCode: 429
    body: '{"error": "Too many requests"}'

mocks:
  - request:
      url: https://api.example.com/users
    response:
      <<: *throttled
  - request:
      url: https://api.example.com/groups
    response:
      <<: *throttled