changeOrigin:true changes Host header but not Origin header
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, nodejs
- Área
- backend, networking
Línea de trabajo
Compara el manejo actual de changeOrigin en lib/node-http-proxy/http-proxy.js con la implementación de v0.10.4 y PR #723. Comprueba el comportamiento del proxy WebSocket descrito en el issue y determina después si cambiar Origin junto con Host es intencionado, y documenta o prueba el comportamiento resultante.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This issue has come up in Vite, which delegates proxying to http-proxy.
When Proxying to a WebSocket service in local development the socket connection can rejected by the server as the Host and Origin header values do not match. This Origin-limiting behaviour is recommended in RFC 6455 and is implemented in the Java websockets API and the Gorillas websocket package.
I looked though http-proxy source code to understand the changeOrigin option. It seems that the option originally did set both Host and Origin headers to match the target, e.g. in version v0.10.4:
A subsequent refactoring for v1.0.0 did not include the setting as far as I can tell. A PR then reinstated the changeOrigin option where it conditionally changes the Host header but not the Origin header. https://github.com/http-party/node-http-proxy/pull/723
So I'm interested to know if dropping the change to the Origin header was for a specific reason, or if it just got missed in the v1.0.0 refactor?
The name "changeOrigin" can be confusing but reflects the terms used the HTTP/1.1 RFC-7230 (Jun 2014). It is notable that the RFC does not mention an Origin header. The Origin header is typically only included in cross-origin requests or same-origin requests other than GET / OPTIONS as defined in RFC-6454 (Dec 2011). I believe the confusion arises from the use of “origin” to mean the originator of a request, and the specific request header. However, it seems reasonable to expect that an option changeOrigin:true would change the Origin header, even if it also changes the Host value.
I can raise a PR to reinstate the Origin change but I'm not clear if there are good reasons not to do so. Given there are quite a few open PRs I'm not confident that project maintainers are in a position to review, merge and release any changes.
Happy to hear any thoughts for or against reinstating the behaviour.
- Lenguaje dominante
- JavaScript
- Estrellas
- 14.1k
- Forks
- 2k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de http-party/node-http-proxy
-
util._extend() is depracatoryAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
http-party/node-http-proxy#1719 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
http-party/node-http-proxy#1721 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 55/100
http-party/node-http-proxy#1715 · 1 comentario · 5 reacciones ·
-
Is this library is dead?Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 15/100
http-party/node-http-proxy#1711 · 2 comentarios ·
-
HTTP3 + QUIC support?Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
http-party/node-http-proxy#1710 · 5 reacciones ·
Todos los issues de http-party/node-http-proxy
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/TypeScript#65370 ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue priority: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
TMHSDigital/Free-Game-Dev-Assets#272 ·
Los mantenedores suelen responder en 1 día
-
metrics priority: medium
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
LearningCircuit/local-deep-research#8336 ·
Los mantenedores suelen responder en 1 día
-
ace bug yaml
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
svelte: whitespace-only edit leaves an empty todo, edits not trimmed, filter not restored on reloadAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100