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

Server middleware is ignored for serverless routes #24

Open
ghost opened this issue Apr 17, 2022 · 0 comments
Open

Server middleware is ignored for serverless routes #24

ghost opened this issue Apr 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Apr 17, 2022

Is your feature request related to a problem? Please describe.
We're currently applying Vite as server middleware on existing Slinkity projects. This works well for statically built pages, and seems to work well enough on serverless route resources as well. However, we noticed that requests to serverless urls skip all applied middleware in the latest 11ty v2 canary.

This is a problem for resources using Vite's special query params. For instance, a JS resource requested by the /about/ url may be represented like so: /about/?html-proxy&index=0.js. This is because Vite rewrites requests for special file extensions (ex. import './Component.jsx' -> /about/?html-proxy&index=Component.js) to intercept via server middleware. Ideally, middleware applied using setServerOptions would intercept this request before 11ty's serverless middleware to handle the request appropriately.

Describe the solution you'd like
Requests to serverless URLs should pass through custom middleware applied via eleventyConfig.setServerOptions.

Describe alternatives you've considered
N/A

Additional context
Applies to both 11ty 2.0 and 1.X browsersync middleware

@ghost ghost added the enhancement New feature or request label Apr 17, 2022
@zachleat zachleat transferred this issue from 11ty/eleventy Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

0 participants