-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed as not planned
Labels
needs discussionIssue needs to be discussedIssue needs to be discussedneeds triageIssue needs to be triagedIssue needs to be triaged
Description
Astro Info
Astro v4.2.6
Node v18.17.0
System macOS (arm64)
Package Manager unknown
Output server
Adapter @astrojs/cloudflare
Integrations @astrojs/tailwind
@astrojs/react
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I thought this was an issue with using the cloudflare adapter, but it seems it happens in a bare bones Astro project.
I'm trying to handle incoming websockets via Page Endpoints, but it seems they are just ignored by Astro.
What's the expected result?
To be able to handle WS (GET) requests with an upgrade header and return the correct response. See the repo, the upgrade request never hits the endpoint:
import { type APIRoute } from 'astro';
export const GET: APIRoute = (ctx) => {
if (ctx.request.headers.get('upgrade') === 'websocket') {
console.log('Got WS request');
} else {
console.log('Got HTTP request');
}
return new Response('hello');
}
In the example, a fetch request comes through ok, just not the WS. Not sure if I'm being stupid, but I can't find any other issues relating to this, but surely someones come across it before!
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-4rev6i?file=src%2Fpages%2Findex.astro
Participation
- I am willing to submit a pull request for this issue.
Metadata
Metadata
Assignees
Labels
needs discussionIssue needs to be discussedIssue needs to be discussedneeds triageIssue needs to be triagedIssue needs to be triaged