Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize cookie minting auth endpoint path #1520

Open
juane1000 opened this issue Apr 10, 2024 · 0 comments
Open

Customize cookie minting auth endpoint path #1520

juane1000 opened this issue Apr 10, 2024 · 0 comments

Comments

@juane1000
Copy link

juane1000 commented Apr 10, 2024

What problem is this solving

When "sessionCookie" is enabled the endpoint generated is on "/api". To my knowledge, there's no option to change that endpoint path. The problem is that our current setup includes a reverse proxy via Firebase Hosting that points to a Cloud Run instance serving a custom api.

firebase.json

{
  // ...firebase config,
  "hosting": [
    {
      "site": "my-site",
      "public": "path/to/nuxt/client/bundle"
      "rewrites": [{ "source": "/api", "run": { "serviceId": "cloud-run-random-api", "region": "us-central1" } }]
    }
  ]
}

The minting endpoint running on the Nuxt server never gets hit because the Firebase Hosting reverse proxy catches it first and sends it off to the Cloud Run instance. Firebase Hosting rewrites don't trim off the "source" path when forwarding the request so in the cloud run instance the request handlers have to be prepended such as "/api/actual-route/".

Due to this hard coded handler path we would prefer not to change the hosting rewrite itself.

Proposed solution

If the nuxt plugin could allow designating the cookie minting path name that would be ideal.

{
  // ...nuxt config,
  vuefire: {
    config: { /* firebase config */ },
    auth: {
      enabled: true,
      sessionCookie: true,
      // would generate "/mint" nuxt server route
      mintingRouteName: "mint"
    }
  }
}

Describe alternatives you've considered

Changing source code of other api servers in our infrastructure so that Firebase Hosting rewrites don't conflict with the nuxt minting server route. Requires too many changes in both front end apps and the back end api route definitions. Would prefer to avoid this.

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

No branches or pull requests

1 participant