Next.js site not rendering when using workers as r...
# workers-help
s
Using workers as a reverse proxy for .example.com to return example.com/id. I've checked the network sources, and the assets are in deed coming through and not 404-ing. But there seems to be parsing error, somewhere.
Copy code
ts

export default {
  async fetch(request: {
    url: string | URL; headers: { get: (arg0: string) => string } 
}, env: any, ctx: any) {
    try {
      const subdomain = request.headers.get('host').split('.')[0];
      // ... map subdomain to id
      const destinationURL = new URL(`http://localhost:3001/${id}`);
      const response = await fetch(destinationURL);
      const proxyResponse = new Response(response.body, { headers: response.headers, status: response.status, statusText: response.statusText})
      return proxyResponse
    } catch (error) {
      return new Response(null, { status: 404, statusText: "Oops can't find that page" });
    }
  },
};
What am I missing here?

https://cdn.discordapp.com/attachments/1109987865154310245/1109987865603084288/image.png