{"id":550252,"date":"2026-10-08T07:28:04","date_gmt":"2026-10-08T07:28:04","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=550252"},"modified":"2026-10-08T07:28:19","modified_gmt":"2026-10-08T07:28:19","slug":"how-proxy-ts-works-in-next-js-16","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/","title":{"rendered":"How proxy.ts Works in Next.js 16: Complete Guide"},"content":{"rendered":"\n<p>How proxy.ts Works in Next.js 16 is essential for handling authentication, redirects, request headers, and request interception before a route is processed.<\/p>\n\n\n\n<p>Whether you need authentication, redirects, header manipulation, or localization, <code>proxy.ts<\/code> allows you to handle these tasks from a single entry point.<\/p>\n\n\n\n<p>Unlike traditional route handlers, <code>proxy.ts<\/code> executes before route matching, making it ideal for request-level logic that applies across your application.<\/p>\n\n\n\n<p>In this guide, you&#8217;ll learn how <code>proxy.ts<\/code> works in Next.js 16, where it fits into the request lifecycle, and how to use it effectively in production applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is proxy.ts?<\/h2>\n\n\n\n<p><code>proxy.ts<\/code> is a special file that intercepts every incoming request before Next.js resolves the destination route.<\/p>\n\n\n\n<p>It enables developers to inspect requests, modify headers, redirect users, rewrite URLs, or block access before rendering a page.<\/p>\n\n\n\n<p>Since it runs early in the request lifecycle, it is commonly used for authentication, localization, feature flags, and security checks.<\/p>\n\n\n\n<p>In previous versions, developers used <code>middleware.ts<\/code> for request interception.<\/p>\n\n\n\n<p>Next.js 16 renamed this file to <code>proxy.ts<\/code> to better reflect its purpose of acting as a request proxy instead of traditional middleware.<\/p>\n\n\n\n<p>The new name improves clarity while keeping the overall development experience familiar for existing projects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When Should You Use proxy.ts?<\/h2>\n\n\n\n<p>Not every application requires <code>proxy.ts<\/code>, but it becomes valuable when request processing must happen before a route is executed.<\/p>\n\n\n\n<p>Instead of repeating logic across multiple pages or API routes, you can centralize it in one location.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Protect authenticated routes.<\/li>\n\n\n\n<li>Redirect users based on conditions.<\/li>\n\n\n\n<li>Handle localization and country detection.<\/li>\n\n\n\n<li>Add or modify request headers.<\/li>\n\n\n\n<li>Apply maintenance mode.<\/li>\n\n\n\n<li>Implement feature flags.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How proxy.ts Works<\/h2>\n\n\n\n<p>Every browser request first passes through <code>proxy.ts<\/code> before Next.js determines which route should handle it.<\/p>\n\n\n\n<p>The file can inspect the request, perform validation, modify information, or redirect the user before continuing.<\/p>\n\n\n\n<p>If no changes are required, the request simply continues to the requested page or API route.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-1200x800.webp\" alt=\"How proxy.ts work in Next js 16\" class=\"wp-image-552418\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-1200x800.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-300x200.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-250x167.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-768x512.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1.webp 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Request Lifecycle in proxy.ts<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>User sends a request.<\/li>\n\n\n\n<li>Next.js executes <code>proxy.ts<\/code>.<\/li>\n\n\n\n<li>Request headers and cookies become available.<\/li>\n\n\n\n<li>Your logic decides whether to continue, rewrite, or redirect.<\/li>\n\n\n\n<li>Next.js renders the matching route.<\/li>\n<\/ul>\n\n\n\n<p>This lifecycle allows applications to apply request-level rules before any page or API logic is executed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating Your First proxy.ts<\/h2>\n\n\n\n<p>Creating a basic <code>proxy.ts<\/code> file is straightforward.<\/p>\n\n\n\n<p>The following example allows every request to continue without modification.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { NextRequest, NextResponse } from &#039;next\/server&#039;;\n\nexport function proxy(request: NextRequest) {\n  return NextResponse.next();\n}<\/pre>\n\n\n\n<p>This is the simplest implementation of <code>proxy.ts<\/code>. It receives the incoming request and forwards it to the next stage of the routing process.<\/p>\n\n\n\n<p>From this starting point, you can gradually introduce authentication, redirects, request rewrites, or header modifications without changing your application routes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Protecting Routes with proxy.ts<\/h2>\n\n\n\n<p>One of the most common production use cases for <code>proxy.ts<\/code> is protecting private routes before they reach your application.<\/p>\n\n\n\n<p>Instead of checking authentication on every page, you can validate the user&#8217;s session once inside <code>proxy.ts<\/code> and redirect unauthenticated users immediately.<\/p>\n\n\n\n<p>This reduces duplicate code and improves security by ensuring protected routes are never rendered for unauthorized users.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { NextRequest, NextResponse } from &#039;next\/server&#039;;\n\nexport function proxy(request: NextRequest) {\n  const token = request.cookies.get(&#039;auth-token&#039;);\n\n  if (!token &amp;&amp; request.nextUrl.pathname.startsWith(&#039;\/dashboard&#039;)) {\n    return NextResponse.redirect(new URL(&#039;\/login&#039;, request.url));\n  }\n\n  return NextResponse.next();\n}<\/pre>\n\n\n\n<p>This example checks for an authentication cookie before allowing access to the dashboard. If no session exists, the user is redirected to the login page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/proxy-2-1200x800.webp\" alt=\"Authentication flow using proxy.ts\" class=\"wp-image-552426\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/proxy-2-1200x800.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/proxy-2-300x200.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/proxy-2-250x167.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/proxy-2-768x512.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/proxy-2.webp 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Redirecting Users Before Routing<\/h2>\n\n\n\n<p>Besides authentication, <code>proxy.ts<\/code> is frequently used to redirect users based on application rules.<\/p>\n\n\n\n<p>Common examples include maintenance mode, language detection, legacy URL migration, or redirecting users to region-specific pages.<\/p>\n\n\n\n<p>Handling these redirects before route matching improves performance and keeps routing logic centralized.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { NextRequest, NextResponse } from &#039;next\/server&#039;;\n\nexport function proxy(request: NextRequest) {\n  const { pathname } = request.nextUrl;\n\n  if (pathname === &#039;\/old-blog&#039;) {\n    return NextResponse.redirect(\n      new URL(&#039;\/blog&#039;, request.url)\n    );\n  }\n\n  return NextResponse.next();\n}<\/pre>\n\n\n\n<p>This example permanently redirects visitors from an old URL to its new destination before the page is rendered.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Modifying Request Headers<\/h2>\n\n\n\n<p>Applications sometimes need to add request metadata before passing control to the requested route.<\/p>\n\n\n\n<p>This is useful for tracking requests, forwarding user information, enabling feature flags, or passing custom headers to downstream services.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { NextRequest, NextResponse } from &#039;next\/server&#039;;\n\nexport function proxy(request: NextRequest) {\n  const requestHeaders = new Headers(request.headers);\n\n  requestHeaders.set(&#039;x-app-version&#039;, &#039;1.0.0&#039;);\n  requestHeaders.set(&#039;x-request-source&#039;, &#039;proxy&#039;);\n\n  return NextResponse.next({\n    request: {\n      headers: requestHeaders,\n    },\n  });\n}<\/pre>\n\n\n\n<p>The updated headers become available to the rest of the application without modifying individual pages or API routes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Config Matchers<\/h2>\n\n\n\n<p>By default, <code>proxy.ts<\/code> can run for every incoming request. In production, this may introduce unnecessary overhead.<\/p>\n\n\n\n<p>Using a matcher limits execution to only the routes that actually require request interception.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">export const config = {\n  matcher: &#091;\n    &#039;\/dashboard\/:path*&#039;,\n    &#039;\/account\/:path*&#039;,\n    &#039;\/checkout\/:path*&#039;,\n  ],\n};<\/pre>\n\n\n\n<p>Restricting execution to selected routes improves performance because public pages bypass <code>proxy.ts<\/code> entirely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Production Use Cases<\/h2>\n\n\n\n<p>Although authentication is the most common implementation, <code>proxy.ts<\/code> supports many production scenarios that benefit from request interception.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Protect authenticated routes.<\/li>\n\n\n\n<li>Redirect users during maintenance windows.<\/li>\n\n\n\n<li>Detect user locale and redirect accordingly.<\/li>\n\n\n\n<li>Enable feature flags for selected users.<\/li>\n\n\n\n<li>Add custom security or tracking headers.<\/li>\n\n\n\n<li>Block suspicious bots or malicious traffic.<\/li>\n\n\n\n<li>Rewrite legacy URLs without changing application routes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">proxy.ts vs Route Handlers<\/h2>\n\n\n\n<p>Although both <code>proxy.ts<\/code> and Route Handlers work with incoming requests, they serve different purposes within a Next.js application.<\/p>\n\n\n\n<p><code>proxy.ts<\/code> executes before route matching and is designed for request interception, while Route Handlers process requests after a specific route has been matched.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>proxy.ts<\/th><th>Route Handlers<\/th><\/tr><\/thead><tbody><tr><td>Execution Time<\/td><td>Before route matching<\/td><td>After route matching<\/td><\/tr><tr><td>Primary Purpose<\/td><td>Intercept requests<\/td><td>Handle API requests<\/td><\/tr><tr><td>Authentication<\/td><td>Excellent<\/td><td>Possible<\/td><\/tr><tr><td>Redirects<\/td><td>Recommended<\/td><td>Limited<\/td><\/tr><tr><td>Header Manipulation<\/td><td>Recommended<\/td><td>Limited<\/td><\/tr><tr><td>Database Operations<\/td><td>Not Recommended<\/td><td>Recommended<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Use <code>proxy.ts<\/code> for request-level decisions and Route Handlers for implementing business logic, database operations, or API endpoints.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">proxy.ts vs middleware.ts<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/routevsproxy-1200x800.webp\" alt=\"proxy.ts vs route handlers\" class=\"wp-image-552423\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/routevsproxy-1200x800.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/routevsproxy-300x200.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/routevsproxy-250x167.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/routevsproxy-768x512.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/08\/routevsproxy.webp 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>If you&#8217;ve previously worked with <code>middleware.ts<\/code>, you&#8217;ll notice that the overall development experience remains very similar.<\/p>\n\n\n\n<p>In Next.js 16, the file was renamed to <code>proxy.ts<\/code> to better describe its responsibility of acting as a request proxy before routing.<\/p>\n\n\n\n<p>Most existing middleware logic can be migrated with minimal code changes, making the transition straightforward for existing applications.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/\/ Before (middleware.ts)\n\nimport { NextResponse } from &#039;next\/server&#039;;\n\nexport function middleware(request) {\n  return NextResponse.next();\n}\n\n\/\/ After (proxy.ts)\n\nimport { NextResponse } from &#039;next\/server&#039;;\n\nexport function proxy(request) {\n  return NextResponse.next();\n}<\/pre>\n\n\n\n<p>For most projects, migrating simply involves renaming the file and updating the exported function from <code>middleware()<\/code> to <code>proxy()<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Performance Best Practices<\/h2>\n\n\n\n<p>Because <code>proxy.ts<\/code> executes before every matched request, keeping it lightweight is essential for maintaining fast response times.<\/p>\n\n\n\n<p>Heavy computations, database queries, and unnecessary external API requests increase request latency for every user.<\/p>\n\n\n\n<p>Instead, limit <code>proxy.ts<\/code> to lightweight request processing and delegate complex work to Route Handlers or Server Components.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use matchers to reduce unnecessary execution.<\/li>\n\n\n\n<li>Keep request processing lightweight.<\/li>\n\n\n\n<li>Avoid database queries inside proxy.ts.<\/li>\n\n\n\n<li>Do not call external APIs whenever possible.<\/li>\n\n\n\n<li>Perform only request-level operations.<\/li>\n\n\n\n<li>Move business logic to Route Handlers or Server Actions.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes to Avoid<\/h2>\n\n\n\n<p>Many performance issues arise because developers treat <code>proxy.ts<\/code> as a general-purpose execution layer instead of a lightweight request interceptor.<\/p>\n\n\n\n<p>Understanding its intended role helps keep applications fast, scalable, and easier to maintain.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Running database queries inside <code>proxy.ts<\/code>.<\/li>\n\n\n\n<li>Fetching third-party APIs on every request.<\/li>\n\n\n\n<li>Executing expensive business logic.<\/li>\n\n\n\n<li>Running proxy.ts for every route without a matcher.<\/li>\n\n\n\n<li>Using proxy.ts instead of Route Handlers for API logic.<\/li>\n\n\n\n<li>Adding unnecessary third-party libraries.<\/li>\n<\/ul>\n\n\n\n<p>A simple, focused implementation is usually faster, easier to debug, and more reliable than placing excessive logic inside <code>proxy.ts<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p><code>proxy.ts<\/code> provides a centralized way to intercept and process requests before they reach your application&#8217;s routes in Next.js 16.<\/p>\n\n\n\n<p>By handling authentication, redirects, localization, and request headers in one place, you can reduce duplicated logic while improving maintainability and performance.<\/p>\n\n\n\n<p>When used correctly, <code>proxy.ts<\/code> becomes an important part of a production-ready Next.js application, helping teams build secure, scalable, and efficient request handling workflows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How proxy.ts Works in Next.js 16 is essential for handling authentication, redirects, request headers, and request interception before a route is processed. Whether you need authentication, redirects, header manipulation, or localization, proxy.ts allows you to handle these tasks from a single entry point. Unlike traditional route handlers, proxy.ts executes before route matching, making it ideal <a href=\"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":758,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-550252","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How proxy.ts Works in Next.js 16: Complete Guide - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Learn how proxy.ts works in Next.js 16 for authentication, redirects, request headers, localization, and production request handling.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How proxy.ts Works in Next.js 16: Complete Guide - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Learn how proxy.ts works in Next.js 16 for authentication, redirects, request headers, localization, and production request handling.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-08T07:28:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-08T07:28:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-1200x800.webp\" \/>\n<meta name=\"author\" content=\"Prayas Jain\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prayas Jain\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/\"},\"author\":{\"name\":\"Prayas Jain\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d4f4f7aae507aa4b78df0080882e7d8\"},\"headline\":\"How proxy.ts Works in Next.js 16: Complete Guide\",\"datePublished\":\"2026-10-08T07:28:04+00:00\",\"dateModified\":\"2026-10-08T07:28:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/\"},\"wordCount\":1143,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/webkul.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/proxyts-1-1200x800.webp\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/\",\"url\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/\",\"name\":\"How proxy.ts Works in Next.js 16: Complete Guide - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/webkul.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/proxyts-1-1200x800.webp\",\"datePublished\":\"2026-10-08T07:28:04+00:00\",\"dateModified\":\"2026-10-08T07:28:19+00:00\",\"description\":\"Learn how proxy.ts works in Next.js 16 for authentication, redirects, request headers, localization, and production request handling.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cdnblog.webkul.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/proxyts-1.webp\",\"contentUrl\":\"https:\\\/\\\/cdnblog.webkul.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/proxyts-1.webp\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/how-proxy-ts-works-in-next-js-16\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/webkul.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How proxy.ts Works in Next.js 16: Complete Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/webkul.com\\\/blog\\\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/webkul.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\\\/\\\/webkul.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/cdnblog.webkul.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\\\/\\\/cdnblog.webkul.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/webkul\\\/\",\"https:\\\/\\\/x.com\\\/webkul\",\"https:\\\/\\\/www.instagram.com\\\/webkul\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/webkul\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/webkul\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/webkul.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d4f4f7aae507aa4b78df0080882e7d8\",\"name\":\"Prayas Jain\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/edd772778412a2d77fff6f1c49e7be1cfe3623e892ac86a851b829c74275e7d3?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/edd772778412a2d77fff6f1c49e7be1cfe3623e892ac86a851b829c74275e7d3?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/edd772778412a2d77fff6f1c49e7be1cfe3623e892ac86a851b829c74275e7d3?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Prayas Jain\"},\"url\":\"https:\\\/\\\/webkul.com\\\/blog\\\/author\\\/prayas-ux322\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How proxy.ts Works in Next.js 16: Complete Guide - Webkul Blog","description":"Learn how proxy.ts works in Next.js 16 for authentication, redirects, request headers, localization, and production request handling.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/","og_locale":"en_US","og_type":"article","og_title":"How proxy.ts Works in Next.js 16: Complete Guide - Webkul Blog","og_description":"Learn how proxy.ts works in Next.js 16 for authentication, redirects, request headers, localization, and production request handling.","og_url":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2026-10-08T07:28:04+00:00","article_modified_time":"2026-10-08T07:28:19+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-1200x800.webp","type":"","width":"","height":""}],"author":"Prayas Jain","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Prayas Jain","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/"},"author":{"name":"Prayas Jain","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/8d4f4f7aae507aa4b78df0080882e7d8"},"headline":"How proxy.ts Works in Next.js 16: Complete Guide","datePublished":"2026-10-08T07:28:04+00:00","dateModified":"2026-10-08T07:28:19+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/"},"wordCount":1143,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-1200x800.webp","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/","url":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/","name":"How proxy.ts Works in Next.js 16: Complete Guide - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1-1200x800.webp","datePublished":"2026-10-08T07:28:04+00:00","dateModified":"2026-10-08T07:28:19+00:00","description":"Learn how proxy.ts works in Next.js 16 for authentication, redirects, request headers, localization, and production request handling.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1.webp","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/proxyts-1.webp","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-proxy-ts-works-in-next-js-16\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How proxy.ts Works in Next.js 16: Complete Guide"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/8d4f4f7aae507aa4b78df0080882e7d8","name":"Prayas Jain","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/edd772778412a2d77fff6f1c49e7be1cfe3623e892ac86a851b829c74275e7d3?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/edd772778412a2d77fff6f1c49e7be1cfe3623e892ac86a851b829c74275e7d3?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/edd772778412a2d77fff6f1c49e7be1cfe3623e892ac86a851b829c74275e7d3?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Prayas Jain"},"url":"https:\/\/webkul.com\/blog\/author\/prayas-ux322\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/550252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/758"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=550252"}],"version-history":[{"count":7,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/550252\/revisions"}],"predecessor-version":[{"id":552463,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/550252\/revisions\/552463"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=550252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=550252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=550252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}