-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Node middleware adapter doesn't match routes when base is set #6335
Labels
- P1: chore
Doesn't change code behavior (priority)
Comments
1 task
mark |
You needn't add a |
import express from 'express'
import { handler } from './dist/server/entry.mjs'
const app = express()
app.use('/mybasepath', express.static('./dist/client'))
app.use(handler)
app.listen(3000, () => {
console.log('Listening on http://localhost:3000')
}) |
Thank you @wulinsheng123 I can confirm that your solution works. Thanks for investigating. |
I think we also need to update this in the doc. |
Yeah, I suppose mentioning this in the readme could be helpful to people. |
I'll take this one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of
astro
are you using?2.0.6
Are you using an SSR adapter? If so, which one?
Node
What package manager are you using?
pnpm
What operating system are you using?
Windows/WSL/Ubuntu
Describe the Bug
Enable SSR using
output: server
and using the node adapter withmode: 'middleware'
, and set a base in astro.config:Create a
server.js
file that creates an express app and hosts the built middleware at/mybasepath
:Build the site, and run the server using
npm run build && node server.js
A 404 status is returned when requesting
http://localhost:3000/mybasepath/
. When running in dev or preview modes, the site is displayed appropriately.Inspecting the running code, it looks like match is prepending an additional '/' before matching, so it is trying to find
//
rather than/
.Link to Minimal Reproducible Example
https://github.com/mdixon4/intergalactic-ice
Participation
The text was updated successfully, but these errors were encountered: