{"record":{"id":"09cbe55ff23a9424","repo":"docmirror/dev-sidecar","slug":"devsidecar-403-request-abort-this-request-is","errorCode":null,"errorMessage":"DevSidecar 403: Request abort.\n\n  This request is matched by abort intercept.\n\n  因配置abort拦截器，本请求直接返回403禁止访问。","messagePattern":"DevSidecar 403: Request abort\\.\n\n  This request is matched by abort intercept\\.\n\n  因配置abort拦截器，本请求直接返回403禁止访问。","errorType":"http","errorClass":null,"httpStatus":403,"severity":"info","filePath":"packages/mitmproxy/src/lib/interceptor/impl/req/abort.js","lineNumber":19,"sourceCode":"module.exports = {\n  name: 'abort',\n  priority: 103,\n  requestIntercept (context, interceptOpt, req, res, ssl, next) {\n    const { rOptions, log } = context\n\n    if (interceptOpt.abort === true || interceptOpt.abort === 'true') {\n      const headers = {\n        'Content-Type': 'text/plain; charset=utf-8',\n        'DS-Interceptor': 'abort',\n      }\n\n      // headers.Access-Control-Allow-*：避免跨域问题\n      if (rOptions.headers.origin) {\n        headers['Access-Control-Allow-Credentials'] = 'true'\n        headers['Access-Control-Allow-Origin'] = rOptions.headers.origin\n      }\n\n      res.writeHead(403, headers)\n      res.write(\n        'DevSidecar 403: Request abort.\\n\\n'\n        + '  This request is matched by abort intercept.\\n\\n'\n        + '  因配置abort拦截器，本请求直接返回403禁止访问。',\n      )\n      res.end()\n\n      const url = `${rOptions.method} ➜ ${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${req.url}`\n      log.info('abort intercept:', url)\n      return true // true代表请求结束\n    } else {\n      const response = interceptOpt.abort\n\n      // status\n      const status = response.status || 403\n\n      // body\n      const body = response.html || response.json || response.script || response.css || response.text || response.body","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/mitmproxy/src/lib/interceptor/impl/req/abort.js#L1-L37","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open dev-sidecar settings → intercept/拦截 list and locate the domain from the 403'd request URL","Remove that domain from the abort list, or change its action from 'abort' to 'proxy'/'redirect'","If it matched via a wildcard or default rule, add a more specific rule for the domain that proxies instead","Save config (it persists a diff to ~/.dev-sidecar/config.json) and retry; no restart is usually needed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before issuing a request through the proxy, check whether its host matches an abort rule:\nconst abortHosts = config.intercepts ? Object.keys(config.intercepts).filter(k => config.intercepts[k].abort) : []\nconst willAbort = abortHosts.some(h => url.hostname === h || url.hostname.endsWith('.' + h))","typeGuard":"function isAbort403(body) {\n  return typeof body === 'string' && body.startsWith('DevSidecar 403: Request abort.')\n}","tryCatchPattern":"const res = await fetch(url, { agent: proxyAgent })\nif (res.status === 403 && (await res.text()).includes('matched by abort intercept')) {\n  // unblock the domain in dev-sidecar intercept settings, then retry\n}","preventionTips":["Keep the abort list limited to ad/tracker domains you never need","Review intercept rules after enabling plugins (overwall etc.) that seed default aborts","When a tool 403s through the proxy, grep the URL host in ~/.dev-sidecar/config.json first","Prefer 'redirect' over 'abort' for domains you might need later"],"tags":["http-403","interceptor","proxy"],"backgroundTag":"request-blocked-by-interceptor","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}