Gatsby off-main-thread redirect 404 error

Netlify Site Name: dradamscheinercom
Preview deploy where this can be seen: https://deploy-preview-1--dradamscheinercom.netlify.app/
Issue:
Hi, I have seen two previous posts related but no answer was found.

I’m attempting to setup Gatsby with “off-main-thread” using their script API. This makes use of SSR with a redirect and the partytown API. Basically the config file gets an array like

  partytownProxiedURLs: [
    `https://www.googletagmanager.com/gtag/js?id=UA-28262865-1`
  ],

During build this is supposed to set up a redirect (and it appears to be from what support has told me) to allow the request to be fulfilled to that URL when requested like this:
https://deploy-preview-1--dradamscheinercom.netlify.app/__third-party-proxy?url=https%3A%2F%2Fwww.googletagmanager.com%2Fgtag%2Fjs%3Fid%3DUA-28262865-1

But if you follow that URL, you will find it is a 404. Support said this is because the redirect is an exact match

/__third-party-proxy url=https%3A%2F%2Fwww.googletagmanager.com%2Fgtag%2Fjs%3Fid%3DUA-28262865-1  https://www.googletagmanager.com/gtag/js?id=UA-28262865-1  200

But when I check the URL it is requesting, it sure look like it is correctly matching.

The “fix” that support has suggested is to manually add a redirect like:

/__third-party-proxy url=:url https://www.googletagmanager.com/gtag/js?id=UA-28262865-1 200!

This might solve this specific request, but I have more than one third-party script to configure, and if I set up a general redirect, it will not work with those new scripts.

Has anyone successfully configured the Gatsby Script API with off-main-thread?

Additional details that may help:

Dependencies:

  "dependencies": {
    "babel-plugin-styled-components": "^2.1.4",
    "gatsby": "^5.13.3",
    "gatsby-adapter-netlify": "^1.1.3",
    "gatsby-plugin-gatsby-cloud": "^5.13.1",
    "gatsby-plugin-google-gtag": "^5.13.1",
    "gatsby-plugin-image": "^3.13.1",
    "gatsby-plugin-manifest": "^5.13.1",
    "gatsby-plugin-netlify": "^5.1.1",
    "gatsby-plugin-purgecss": "^6.2.1",
    "gatsby-plugin-sharp": "^5.13.1",
    "gatsby-plugin-sitemap": "^6.13.1",
    "gatsby-plugin-styled-components": "^6.13.1",
    "gatsby-plugin-webfonts": "^2.3.2",
    "gatsby-source-filesystem": "^5.13.1",
    "gatsby-source-wordpress": "^7.13.3",
    "gatsby-transformer-sharp": "^5.13.1",
    "html-loader": "^5.0.0",
    "html-react-parser": "^5.1.10",
    "react": "^18.2.0",
    "react-compare-slider": "^3.0.1",
    "react-dom": "^18.2.0",
    "styled-components": "^6.1.8"
  }
1 Like

I’d really like an answer to this, I had to eventually give up trying to make it work and use Cloudflare Zaraz, but I’d really like it if I could use this instead

You can add query parameters for each resource needed: Redirect options | Netlify Docs