netlify-cli 17.37.0-rc-redirect.0 → 17.37.0-rc-redirects.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -570,6 +570,23 @@ const onRequest = async ({ addonsUrls, api, edgeFunctionsProxy, env, functionsRe
570
570
  if (edgeFunctionsProxyURL !== undefined) {
571
571
  return proxy.web(req, res, { target: edgeFunctionsProxyURL });
572
572
  }
573
+ const match = await rewriter(req);
574
+ const options = {
575
+ match,
576
+ addonsUrls,
577
+ target: `http://${settings.frameworkHost && isIPv6(settings.frameworkHost) ? `[${settings.frameworkHost}]` : settings.frameworkHost}:${settings.frameworkPort}`,
578
+ publicFolder: settings.dist,
579
+ functionsServer,
580
+ functionsPort: settings.functionsPort,
581
+ jwtRolePath: settings.jwtRolePath,
582
+ framework: settings.framework,
583
+ };
584
+ if (match) {
585
+ // We don't want to generate an ETag for 3xx redirects.
586
+ // @ts-expect-error TS(7031) FIXME: Binding element 'statusCode' implicitly has an 'an... Remove this comment to see the full error message
587
+ req[shouldGenerateETag] = ({ statusCode }) => statusCode < 300 || statusCode >= 400;
588
+ return serveRedirect({ req, res, proxy, imageProxy, match, options, siteInfo, env, functionsRegistry });
589
+ }
573
590
  const functionMatch = functionsRegistry &&
574
591
  (await functionsRegistry.getFunctionForURLPath(req.url, req.method, () => getStatic(decodeURIComponent(reqToURL(req, req.url).pathname), settings.dist ?? '')));
575
592
  if (functionMatch) {
@@ -591,23 +608,6 @@ const onRequest = async ({ addonsUrls, api, edgeFunctionsProxy, env, functionsRe
591
608
  if (addonUrl) {
592
609
  return handleAddonUrl({ req, res, addonUrl });
593
610
  }
594
- const match = await rewriter(req);
595
- const options = {
596
- match,
597
- addonsUrls,
598
- target: `http://${settings.frameworkHost && isIPv6(settings.frameworkHost) ? `[${settings.frameworkHost}]` : settings.frameworkHost}:${settings.frameworkPort}`,
599
- publicFolder: settings.dist,
600
- functionsServer,
601
- functionsPort: settings.functionsPort,
602
- jwtRolePath: settings.jwtRolePath,
603
- framework: settings.framework,
604
- };
605
- if (match) {
606
- // We don't want to generate an ETag for 3xx redirects.
607
- // @ts-expect-error TS(7031) FIXME: Binding element 'statusCode' implicitly has an 'an... Remove this comment to see the full error message
608
- req[shouldGenerateETag] = ({ statusCode }) => statusCode < 300 || statusCode >= 400;
609
- return serveRedirect({ req, res, proxy, imageProxy, match, options, siteInfo, env, functionsRegistry });
610
- }
611
611
  // The request will be served by the framework server, which means we want to
612
612
  // generate an ETag unless we're rendering an error page. The only way for
613
613
  // us to know that is by looking at the status code
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "17.37.0-rc-redirect.0",
3
+ "version": "17.37.0-rc-redirects.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "17.37.0-rc-redirect.0",
9
+ "version": "17.37.0-rc-redirects.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "17.37.0-rc-redirect.0",
4
+ "version": "17.37.0-rc-redirects.0",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {