-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Could __og_image__
be a route instead of a middleware?
#101
Comments
Yes, this would be ideal, when I implemented the module there wasn't support for registrating routes as Afaik this still isn't supporting but something that would be good to solve upstream for use-cases like this. |
Couldn't the route be restructured so that I want to ask still because I can imagine that there are difficulties in how to map |
Or maybe |
Could be worth exploring 👍 I had planned to add support for customising the endpoint so can explore when I do that. |
What about dynamic routes 😅 |
Wasn't sure if the syntax supports that case. Tried the following: https://paths.esm.dev/?p=AAMeJSyAwR4UbFDAFxAcAGAIJnP6oEV7Ap7NWgS8QAEAHQLUgFOnUYGTAIk.&t=/some/page/__og_image__# Does that look right to you? Haven't played with Edit: and it must be configurable for nitro right? Which |
Yes, nitro only, unfortunately. It uses radix3 https://github.com/unjs/radix3 |
@KyleSmith0905 was quick: unjs/radix3#68 |
If you'll want a temporary solution: I've added this to my routeRules: ...[0, 1, 2, 3, 4, 5].reduce<Record<string, Partial<NitroRouteConfig>>>((acc, cur) => {
acc[Array(cur).fill('/*').join('') + '/__og_image__/og.png'] = {
headers: {
'Cross-Origin-Resource-Policy': 'cross-origin'
}
}
return acc
}, {}) This would give the following routes a certain header: So it should match any route that is 4 levels deep. (I hope) |
Will be fixed in the next update, see #114 |
Details
Currently,
/__og_image__
's content is set by a middleware. As this middleware returns content, I think other modules' middlewares cannot modify the returned content, e.g.nuxt-security
adding a nonce.How would it be possible for other middleware to modify that page? Should the linked middleware be implemented as a nitro route instead maybe?
The text was updated successfully, but these errors were encountered: