You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sirv responds to HTTP requests other than GET, thereby masking those routes (e.g., POST) on Polka servers as it is global middleware. It also responds to WebSocket upgrade requests so if a static route (e.g., /echo/index.html) and a WebSocket route (e.g., /echo) share the same route, it prevents the WebSocket route from being called.
Example
I have a Polka server that uses sirv to serve the static folder:
static
╰ echo
╰ index.html
I also have a POST route and a WebSocket route on /echo. I make the following requests:
A GET request to /echo
A POST request to /echo
A WebSocket request to /echo
What happens
sirv responds to all requests to /echo with the static page regardless of HTTP method or whether or not the GET request is a WebSocket upgrade request.
What should happen
sirv should ignore all requests methods other than GET requests that are not WebSocket upgrade requests. In all other cases, it should call next() (or return a not found status if there isn’t a next middleware).
The text was updated successfully, but these errors were encountered:
aral
linked a pull request
Jan 16, 2022
that will
close
this issue
Problem summary
sirv responds to HTTP requests other than GET, thereby masking those routes (e.g., POST) on Polka servers as it is global middleware. It also responds to WebSocket upgrade requests so if a static route (e.g., /echo/index.html) and a WebSocket route (e.g., /echo) share the same route, it prevents the WebSocket route from being called.
Example
I have a Polka server that uses sirv to serve the static folder:
I also have a POST route and a WebSocket route on
/echo
. I make the following requests:GET
request to/echo
POST
request to/echo
/echo
What happens
sirv responds to all requests to
/echo
with the static page regardless of HTTP method or whether or not theGET
request is a WebSocket upgrade request.What should happen
sirv should ignore all requests methods other than
GET
requests that are not WebSocket upgrade requests. In all other cases, it should callnext()
(or return a not found status if there isn’t a next middleware).The text was updated successfully, but these errors were encountered: