Skip to content

Commit b2f3148

Browse files
committed
Remove Agent-specific proxy routes
1 parent 2b79c31 commit b2f3148

8 files changed

Lines changed: 7 additions & 173 deletions

File tree

.changeset/bright-agents-proxy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/hydrogen': patch
3+
---
4+
5+
Direct Storefront Agent proxy routes have been removed. Route Storefront Agent requests through the generic Shopify API proxy under `/__shopify/*`.

packages/hydrogen/skills/hydrogen-request-handlers/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Request
2727
-> framework 404 page
2828
```
2929

30-
`handleShopifyRoutes` owns Hydrogen routes the framework should never see: SFAPI proxy URLs, `/checkout`, cart permalinks like `/cart/{variantId}:{quantity}`, AJAX cart URLs like `/cart.js` and `/cart/add.js`, `/api/mcp`, `/agent/*`, `/graphiql` in development, and app-registered handler groups such as `createCartServerHandlers()` or `createCustomerAccountServerHandlers()`.
30+
`handleShopifyRoutes` owns Hydrogen routes the framework should never see: SFAPI proxy URLs, the generic `/__shopify/*` API proxy, `/checkout`, cart permalinks like `/cart/{variantId}:{quantity}`, AJAX cart URLs like `/cart.js` and `/cart/add.js`, `/api/mcp`, `/graphiql` in development, and app-registered handler groups such as `createCartServerHandlers()` or `createCustomerAccountServerHandlers()`.
3131

3232
`handleShopifyRedirects` is a post-routing 404 check for `/admin`, configured standard route redirects, Storefront URL redirects, and same-origin query-param redirects. Do not run it on every request.
3333

packages/hydrogen/skills/hydrogen-setup/steps/2-scaffold.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Preserve the app's existing route shape when present. When there is no establish
1010
- `/products/{handle}` for product detail. Use plural `products`, not `/product`.
1111
- `/cart` for the full cart page.
1212

13-
Hydrogen-owned handlers are not page routes: `/api/cart`, `/api/{api-version}/graphql.json`, `/checkout`, cart permalinks like `/cart/{variantId}:{quantity}`, AJAX cart URLs like `/cart.js` and `/cart/add.js`, `/api/mcp`, `/agent/*`, `/graphiql` in development, `/admin` redirects, and Storefront URL redirects belong in the `hydrogen-request-handlers` wiring.
13+
Hydrogen-owned handlers are not page routes: `/api/cart`, `/api/{api-version}/graphql.json`, the generic `/__shopify/*` API proxy, `/checkout`, cart permalinks like `/cart/{variantId}:{quantity}`, AJAX cart URLs like `/cart.js` and `/cart/add.js`, `/api/mcp`, `/graphiql` in development, `/admin` redirects, and Storefront URL redirects belong in the `hydrogen-request-handlers` wiring.
1414

1515
Invoke the `hydrogen-routing` skill and create the shared route template manifest for Shopify resources such as products, collections, pages, blogs, or articles.
1616

packages/hydrogen/src/core/headers.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const REQUEST_GROUP_ID_HEADER = "Custom-Storefront-Request-Group-ID";
66
export const SDK_VARIANT_HEADER = "X-SDK-Variant";
77
export const SDK_VARIANT_SOURCE_HEADER = "X-SDK-Variant-Source";
88
export const SDK_VERSION_HEADER = "X-SDK-Version";
9-
export const SHOPIFY_CHAT_FRAME_ORIGIN_HEADER = "Sec-Shopify-Chat-Frame-Origin";
109
export const SHOPIFY_STOREFRONT_ORIGIN_HEADER = "Sec-Shopify-Storefront-Origin";
1110
export const STOREFRONT_ID_HEADER = "Shopify-Storefront-Id";
1211
export const SHOPIFY_STOREFRONT_S_HEADER = "Shopify-Storefront-S";
@@ -51,7 +50,6 @@ export type ShopifyHeaderName =
5150
| typeof SDK_VARIANT_HEADER
5251
| typeof SDK_VARIANT_SOURCE_HEADER
5352
| typeof SDK_VERSION_HEADER
54-
| typeof SHOPIFY_CHAT_FRAME_ORIGIN_HEADER
5553
| typeof SHOPIFY_STOREFRONT_ORIGIN_HEADER
5654
| typeof SHOPIFY_STOREFRONT_S_HEADER
5755
| typeof SHOPIFY_STOREFRONT_Y_HEADER
@@ -118,8 +116,6 @@ export const SFAPI_REQUEST_HEADER_ALLOWLIST = defineHeaderList(
118116

119117
export const MCP_REQUEST_HEADER_ALLOWLIST = defineHeaderList(...COMMON_PROXY_HEADER_ALLOWLIST);
120118

121-
export const AGENT_REQUEST_HEADER_ALLOWLIST = defineHeaderList(...COMMON_PROXY_HEADER_ALLOWLIST);
122-
123119
export const AJAX_API_REQUEST_HEADER_ALLOWLIST = defineHeaderList(
124120
...COMMON_PROXY_HEADER_ALLOWLIST,
125121
"content-length",

packages/hydrogen/src/core/request-routing/handle-shopify-routes.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { handleAgentProxy } from "./interceptors/agent-proxy";
21
import { handleAjaxApi } from "./interceptors/ajax-api";
32
import { handleShopifyApiProxy } from "./interceptors/api-proxy";
43
import { handleCheckoutRedirect } from "./interceptors/checkout";
@@ -16,7 +15,6 @@ const SHOPIFY_ROUTE_INTERCEPTORS = [
1615
handleCheckoutRedirect,
1716
handleWellKnownProxy,
1817
handleMcpProxy,
19-
handleAgentProxy,
2018
handleAjaxApi,
2119
] satisfies readonly HydrogenRouteInterceptor[];
2220

packages/hydrogen/src/core/request-routing/interceptors/agent-proxy.test.ts

Lines changed: 0 additions & 149 deletions
This file was deleted.

packages/hydrogen/src/core/request-routing/interceptors/agent-proxy.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/hydrogen/src/core/url.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ export function isHydrogenServerHandoffPath(pathname: string): boolean {
2929
);
3030
}
3131

32-
export const AGENT_BUYER_CLAIMS_RE =
33-
/^(?:\/[a-z]{2}(?:-[a-z]{2})?)?\/agent\/(?:handoff|buyer-claims)(?:\.[^/.]+)?\/?$/i;
3432
export const WELL_KNOWN_RE = /^\/\.well-known\/(?:apple-developer-merchantid-domain-association)$/;
3533
export const AJAX_CART_RE =
3634
/^(?:\/[a-z]{2}(?:-[a-z]{2})?)?\/cart(?:\.(?:js|json)|\/(?:add|update|change|clear)(?:\.(?:js|json))?)$/i;

0 commit comments

Comments
 (0)