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

How to exclude URLs matching a pattern? #30

Open
lilouartz opened this issue Aug 17, 2024 · 2 comments
Open

How to exclude URLs matching a pattern? #30

lilouartz opened this issue Aug 17, 2024 · 2 comments

Comments

@lilouartz
Copy link

Basically, I want to not use the session middleware for URLs that describe an image. How do I do that?

app.register(fastifyCookie);

app.register(fastifySession, {
  cookie: {
    httpOnly: true,
    maxAge: SESSION_TTL,
    sameSite: 'lax',
    secure: config.USE_SECURE_COOKIES,
  },
  cookieName: '_pillser',
  saveUninitialized: true,
  secret: config.SESSION_SECRET,
  store: new RedisStore({
    client: redis,
    ttl: SESSION_TTL,
  }),
});
@lilouartz
Copy link
Author

Familiarizing with the implementation of the plugin, looks like this is something that would need to be natively supported by the plugin itself. It would be nice if there was an option to filter when the plugin is applied based on the URL.

@mgcrea
Copy link
Owner

mgcrea commented Oct 21, 2024

I think fastify.register(myPlugin, { prefix: '/special' }); is what you want.

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

No branches or pull requests

2 participants