Skip to content

Do Next.js rewrites with an external destination (proxying) work with web framework? #5976

Closed

Description

[REQUIRED] Environment info

firebase-tools: 12.3.1 (latest as of now)

Platform: Windows (locally)

[REQUIRED] Test case

  • add an external destionation to the nextjs config rewrites.

[REQUIRED] Steps to reproduce

Here is what my rewrites look like:
async rewrites() {
return [
{
source: "/mp/track/:slug*",
destination: "https://api-js.mixpanel.com/track/:slug*",
},
{
source: "/mp/engage/:slug*",
destination: "https://api-js.mixpanel.com/engage/:slug*",
},
{
source: "/mp/:slug*",
destination: "https://api-js.mixpanel.com/:slug*",
},
];
},

[REQUIRED] Expected behavior

Locally this works and the nextjs server just proxies the request.

[REQUIRED] Actual behavior

Once it deploys with firebase via the SSR Cloud function, the logs for the ssrproject function show that it first issues a redirect (from https://.com/mp/track/?verbose=1 to https:///mp/track?_=1686698765113&ip=1&verbose=1) and when the app tries to hit that second url it sends a 408.

I've looked through a ton of the docs. It doesn't say anywhere that external rewrites like this aren't supported. That would be my first question, is this possible?

Secondly the cloud function just logs the response (308 at first, and then a 408), so if you have suggestions for extra debugging help, I'm all ears.

Activity

  1. google-oss-bot commented on Jun 13, 2023

    @google-oss-bot
    Collaborator

    This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions