[{"data":1,"prerenderedAt":457},["ShallowReactive",2],{"navigation":3,"-utils-proxy":193,"-utils-proxy-surround":452},[4,91,138,170,177],{"title":5,"path":6,"stem":7,"children":8,"icon":90},"Guide","/guide","1.guide/0.index",[9,12,53,69],{"title":10,"path":6,"stem":7,"icon":11},"Getting Started","pixel:play",{"title":5,"icon":13,"path":14,"stem":15,"children":16,"page":52},"ph:book-open-duotone","/guide/basics","1.guide/1.basics",[17,22,27,32,37,42,47],{"title":18,"path":19,"stem":20,"icon":21},"Request Lifecycle","/guide/basics/lifecycle","1.guide/1.basics/1.lifecycle","icon-park-outline:handle-round",{"title":23,"path":24,"stem":25,"icon":26},"Routing","/guide/basics/routing","1.guide/1.basics/2.routing","solar:routing-bold",{"title":28,"path":29,"stem":30,"icon":31},"Middleware","/guide/basics/middleware","1.guide/1.basics/3.middleware","mdi:middleware-outline",{"title":33,"path":34,"stem":35,"icon":36},"Event Handlers","/guide/basics/handler","1.guide/1.basics/4.handler","mdi:function",{"title":38,"path":39,"stem":40,"icon":41},"Sending Response","/guide/basics/response","1.guide/1.basics/5.response","tabler:json",{"title":43,"path":44,"stem":45,"icon":46},"Error Handling","/guide/basics/error","1.guide/1.basics/6.error","tabler:error-404",{"title":48,"path":49,"stem":50,"icon":51},"Nested Apps","/guide/basics/nested-apps","1.guide/1.basics/7.nested-apps","material-symbols-light:layers-outline",false,{"title":54,"icon":55,"path":56,"stem":57,"children":58,"page":52},"API","material-symbols-light:api-rounded","/guide/api","1.guide/900.api",[59,64],{"title":60,"path":61,"stem":62,"icon":63},"H3","/guide/api/h3","1.guide/900.api/1.h3","material-symbols:bolt-rounded",{"title":65,"path":66,"stem":67,"icon":68},"H3Event","/guide/api/h3event","1.guide/900.api/2.h3event","material-symbols:data-object-rounded",{"title":70,"icon":71,"path":72,"stem":73,"children":74,"page":52},"Advanced","hugeicons:more-01","/guide/advanced","1.guide/901.advanced",[75,80,85],{"title":76,"path":77,"stem":78,"icon":79},"Plugins","/guide/advanced/plugins","1.guide/901.advanced/1.plugins","clarity:plugin-line",{"title":81,"path":82,"stem":83,"icon":84},"WebSockets","/guide/advanced/websocket","1.guide/901.advanced/2.websocket","hugeicons:live-streaming-02",{"title":86,"path":87,"stem":88,"icon":89},"Nightly Builds","/guide/advanced/nightly","1.guide/901.advanced/9.nightly","game-icons:barn-owl","i-ph:book-open-duotone",{"title":92,"path":93,"stem":94,"children":95,"icon":97},"Utils","/utils","2.utils/0.index",[96,98,103,108,113,118,123,128,133],{"title":92,"path":93,"stem":94,"icon":97},"ph:function-bold",{"title":99,"path":100,"stem":101,"icon":102},"Request","/utils/request","2.utils/1.request","material-symbols-light:input",{"title":104,"path":105,"stem":106,"icon":107},"Response","/utils/response","2.utils/2.response","material-symbols-light:output",{"title":109,"path":110,"stem":111,"icon":112},"Cookie","/utils/cookie","2.utils/3.cookie","material-symbols:cookie-outline",{"title":114,"path":115,"stem":116,"icon":117},"Security","/utils/security","2.utils/4.security","wpf:key-security",{"title":119,"path":120,"stem":121,"icon":122},"Proxy","/utils/proxy","2.utils/5.proxy","arcticons:super-proxy",{"title":124,"path":125,"stem":126,"icon":127},"MCP","/utils/mcp","2.utils/6.mcp","material-symbols:swap-calls",{"title":129,"path":130,"stem":131,"icon":132},"More utils","/utils/more","2.utils/9.more","mingcute:plus-line",{"title":134,"path":135,"stem":136,"icon":137},"Community","/utils/community","2.utils/99.community","lets-icons:external",{"title":139,"path":140,"stem":141,"children":142,"icon":144},"Examples","/examples","4.examples/0.index",[143,145,150,154,158,162,166],{"title":139,"path":140,"stem":141,"icon":144},"ph:code",{"title":146,"path":147,"stem":148,"icon":149},"Cookies","/examples/handle-cookie","4.examples/handle-cookie","ph:arrow-right",{"title":151,"path":152,"stem":153,"icon":149},"HTTP QUERY Method","/examples/handle-query","4.examples/handle-query",{"title":155,"path":156,"stem":157,"icon":149},"Sessions","/examples/handle-session","4.examples/handle-session",{"title":159,"path":160,"stem":161,"icon":149},"Static Assets","/examples/serve-static-assets","4.examples/serve-static-assets",{"title":163,"path":164,"stem":165,"icon":149},"Stream Response","/examples/stream-response","4.examples/stream-response",{"title":167,"path":168,"stem":169,"icon":149},"Validate Data","/examples/validate-data","4.examples/validate-data",{"title":171,"path":172,"stem":173,"children":174,"icon":176},"Migration","/migration","5.migration/0.index",[175],{"title":171,"path":172,"stem":173,"icon":176},"icons8:up-round",{"title":178,"path":179,"stem":180,"children":181},"Blog","/blog","99.blog",[182,185,189],{"title":178,"path":179,"stem":183,"icon":184},"99.blog/index","i-lucide-file-text",{"title":186,"path":187,"stem":188,"icon":184},"H3 1.8 - Towards the Edge of the Web","/blog/v1.8","99.blog/1.v1.8",{"title":190,"path":191,"stem":192,"icon":184},"H3 v2 beta","/blog/v2-beta","99.blog/2.v2-beta",{"id":194,"title":119,"body":195,"description":445,"extension":446,"meta":447,"navigation":449,"path":120,"seo":450,"stem":121,"__hash__":451},"content/2.utils/5.proxy.md",{"type":196,"value":197,"toc":439,"icon":122},"minimark",[198,206,210,225,235,241,244,250,253,263,270,276,279,289,300,311,316,435],[199,200,202],"h3",{"id":201},"fetchwitheventevent-url-init",[203,204,205],"code",{},"fetchWithEvent(event, url, init?)",[207,208,209],"p",{},"Make a fetch request with the event's context and headers.",[207,211,212,213,216,217,220,221,224],{},"If the ",[203,214,215],{},"url"," starts with ",[203,218,219],{},"/",", the request is dispatched internally via ",[203,222,223],{},"event.app.fetch()"," (sub-request) and never leaves the process.",[207,226,227,231,232,234],{},[228,229,230],"strong",{},"Security:"," Never pass unsanitized user input as the ",[203,233,215],{},". Callers are responsible for validating and restricting the URL.",[199,236,238],{"id":237},"getproxyrequestheadersevent",[203,239,240],{},"getProxyRequestHeaders(event)",[207,242,243],{},"Get the request headers object without headers known to cause issues when proxying.",[199,245,247],{"id":246},"proxyevent-target-opts",[203,248,249],{},"proxy(event, target, opts)",[207,251,252],{},"Make a proxy request to a target URL and send the response back to the client.",[207,254,212,255,216,258,220,260,262],{},[203,256,257],{},"target",[203,259,219],{},[203,261,223],{}," (sub-request) and never leaves the process. This bypasses any external security layer (reverse proxy auth, IP allowlisting, mTLS).",[207,264,265,231,267,269],{},[228,266,230],{},[203,268,257],{},". Callers are responsible for validating and restricting the target URL (e.g. allowlisting hosts, blocking internal paths, enforcing protocol).",[199,271,273],{"id":272},"proxyrequestevent-target-opts",[203,274,275],{},"proxyRequest(event, target, opts)",[207,277,278],{},"Proxy the incoming request to a target URL.",[207,280,212,281,216,283,285,286,288],{},[203,282,257],{},[203,284,219],{},", the request is handled internally by the app router via ",[203,287,223],{}," instead of making an external HTTP request.",[207,290,291,292,295,296,299],{},"The request body is streamed to the target without buffering. Per the Fetch standard, a request body can only be consumed once, so reading it beforehand (e.g. via ",[203,293,294],{},"readBody()",", ",[203,297,298],{},"readFormData()",", or body-reading middleware) locks the stream and proxying fails. If you need to inspect the body and still proxy it, read from a clone and leave the original event untouched.",[207,301,302,231,304,306,307,310],{},[228,303,230],{},[203,305,257],{},". Callers are responsible for validating and restricting the target URL (e.g. allowlisting hosts, blocking internal paths, enforcing protocol). Consider using ",[203,308,309],{},"bodyLimit()"," middleware to prevent large request bodies from consuming excessive resources when proxying untrusted input.",[207,312,313],{},[228,314,315],{},"Example:",[317,318,323],"pre",{"className":319,"code":320,"language":321,"meta":322,"style":322},"language-ts shiki shiki-themes github-light github-dark github-dark","app.all(\"/proxy\", async (event) => {\n  const body = await event.req.clone().json(); // read from the clone\n  // ...inspect body...\n  return proxyRequest(event, \"/target\"); // original stream still intact\n});\n","ts","",[203,324,325,367,402,408,429],{"__ignoreMap":322},[326,327,330,334,338,341,345,347,351,354,358,361,364],"span",{"class":328,"line":329},"line",1,[326,331,333],{"class":332},"slsVL","app.",[326,335,337],{"class":336},"shcOC","all",[326,339,340],{"class":332},"(",[326,342,344],{"class":343},"sfrk1","\"/proxy\"",[326,346,295],{"class":332},[326,348,350],{"class":349},"so5gQ","async",[326,352,353],{"class":332}," (",[326,355,357],{"class":356},"sQHwn","event",[326,359,360],{"class":332},") ",[326,362,363],{"class":349},"=>",[326,365,366],{"class":332}," {\n",[326,368,370,373,377,380,383,386,389,392,395,398],{"class":328,"line":369},2,[326,371,372],{"class":349},"  const",[326,374,376],{"class":375},"suiK_"," body",[326,378,379],{"class":349}," =",[326,381,382],{"class":349}," await",[326,384,385],{"class":332}," event.req.",[326,387,388],{"class":336},"clone",[326,390,391],{"class":332},"().",[326,393,394],{"class":336},"json",[326,396,397],{"class":332},"(); ",[326,399,401],{"class":400},"sCsY4","// read from the clone\n",[326,403,405],{"class":328,"line":404},3,[326,406,407],{"class":400},"  // ...inspect body...\n",[326,409,411,414,417,420,423,426],{"class":328,"line":410},4,[326,412,413],{"class":349},"  return",[326,415,416],{"class":336}," proxyRequest",[326,418,419],{"class":332},"(event, ",[326,421,422],{"class":343},"\"/target\"",[326,424,425],{"class":332},"); ",[326,427,428],{"class":400},"// original stream still intact\n",[326,430,432],{"class":328,"line":431},5,[326,433,434],{"class":332},"});\n",[436,437,438],"style",{},"html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":322,"searchDepth":369,"depth":369,"links":440},[441,442,443,444],{"id":201,"depth":404,"text":205},{"id":237,"depth":404,"text":240},{"id":246,"depth":404,"text":249},{"id":272,"depth":404,"text":275},"H3 proxy utilities.","md",{"automd":448,"icon":122},true,{"icon":122},{"title":119,"description":445},"kIfzfux8YeTFX3BPDnAjw0kQBOIxcR4TiDrZi0xj9S0",[453,455],{"title":114,"path":115,"stem":116,"description":454,"icon":117,"children":-1},"H3 security utilities.",{"title":124,"path":125,"stem":126,"description":456,"icon":127,"children":-1},"H3 MCP related utils.",1783690730145]