docmirror/dev-sidecar · info

DevSidecar 403: Request abort. This request is matched by

Error message

DevSidecar 403: Request abort.

  This request is matched by abort intercept.

  因配置abort拦截器,本请求直接返回403禁止访问。

What it means

This is not an exception but an HTTP 403 response body. When a request matches a configured 'abort' interceptor rule, dev-sidecar intentionally terminates the request and writes this bilingual 403 body, adding CORS headers if the request has an Origin. The library is telling you the block is by configuration, not a fault.

Source

Thrown at packages/mitmproxy/src/lib/interceptor/impl/req/abort.js:19

module.exports = {
  name: 'abort',
  priority: 103,
  requestIntercept (context, interceptOpt, req, res, ssl, next) {
    const { rOptions, log } = context

    if (interceptOpt.abort === true || interceptOpt.abort === 'true') {
      const headers = {
        'Content-Type': 'text/plain; charset=utf-8',
        'DS-Interceptor': 'abort',
      }

      // headers.Access-Control-Allow-*:避免跨域问题
      if (rOptions.headers.origin) {
        headers['Access-Control-Allow-Credentials'] = 'true'
        headers['Access-Control-Allow-Origin'] = rOptions.headers.origin
      }

      res.writeHead(403, headers)
      res.write(
        'DevSidecar 403: Request abort.\n\n'
        + '  This request is matched by abort intercept.\n\n'
        + '  因配置abort拦截器,本请求直接返回403禁止访问。',
      )
      res.end()

      const url = `${rOptions.method} ➜ ${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${req.url}`
      log.info('abort intercept:', url)
      return true // true代表请求结束
    } else {
      const response = interceptOpt.abort

      // status
      const status = response.status || 403

      // body
      const body = response.html || response.json || response.script || response.css || response.text || response.body

View on GitHub (pinned to 7710cd56cc)

Solutions

  1. Open dev-sidecar settings → intercept/拦截 list and locate the domain from the 403'd request URL
  2. Remove that domain from the abort list, or change its action from 'abort' to 'proxy'/'redirect'
  3. If it matched via a wildcard or default rule, add a more specific rule for the domain that proxies instead
  4. Save config (it persists a diff to ~/.dev-sidecar/config.json) and retry; no restart is usually needed
Defensive patterns

Strategy: try-catch

Validate before calling

// Before issuing a request through the proxy, check whether its host matches an abort rule:
const abortHosts = config.intercepts ? Object.keys(config.intercepts).filter(k => config.intercepts[k].abort) : []
const willAbort = abortHosts.some(h => url.hostname === h || url.hostname.endsWith('.' + h))

Type guard

function isAbort403(body) {
  return typeof body === 'string' && body.startsWith('DevSidecar 403: Request abort.')
}

Try / catch

const res = await fetch(url, { agent: proxyAgent })
if (res.status === 403 && (await res.text()).includes('matched by abort intercept')) {
  // unblock the domain in dev-sidecar intercept settings, then retry
}

Prevention

When it happens

Trigger: A request whose hostname (and optionally path) matches an entry in config intercepts with action 'abort' — typically domains listed under dns/hosts blocking or user-added abort rules in the intercept settings.

Common situations: User enabled ' removal of ads/tracking domains' or overwall/plugin rules that abort certain hosts; a site the developer needs was added to the abort list (or matches a wildcard) so the app in development gets 403s through the proxy.

Related errors


AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31). Data as JSON: /api/errors/09cbe55ff23a9424. Report an issue: GitHub.