Skip to content

Server middleware is ignored for serverless routes #24

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions