<!DOCTYPE html>
<html>
<head>
<title>Socket.IO chat</title>
</head>
<body>
<ul id="messages"></ul>
<form id="form" action="">
<input id="input" autocomplete="off" /><button>Send</button>
</form>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
var messages = document.getElementById("messages");
var form = document.getElementById("form");
var input = document.getElementById("input");
form.addEventListener("submit", function (e) {
e.preventDefault();
if (input.value) {
socket.emit("chat message", input.value);
input.value = "";
}
});
socket.on("chat message", function (msg) {
var item = document.createElement("li");
item.textContent = msg;
messages.appendChild(item);
window.scrollTo(0, document.body.scrollHeight);
});
</script>
</body>
</html>
There is not x-my-id printed in the log.
Step-by-step reproduction instructions
Please see above examle.
Expected behavior (be clear and concise)
The header should be added and printed in the console log.
How is http-proxy-middleware used in your project?
λ yarn why http-proxy-middleware
yarn why v1.22.19
warning package.json: No license field
[1/4] Why do we have the module "http-proxy-middleware"...?
[2/4] Initialising dependency graph...
warning socket-chat-example@0.0.1: No license field
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "http-proxy-middleware@2.0.6"
info Has been hoisted to "http-proxy-middleware"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "148KB"
info Disk size with unique dependencies: "548KB"
info Disk size with transitive dependencies: "2.67MB"
info Number of shared dependencies: 6
Done in 0.28s.
What http-proxy-middleware configuration are you using?
N/A
What OS/version and node/version are you seeing the problem?
Checks
http-proxy-middleware
.Describe the bug (be clear and concise)
Attempt modify the header in the
onProxyReqWs
for a websocket request, but failed.In the proxy:
In the server:
The index.thml:
There is not
x-my-id
printed in the log.Step-by-step reproduction instructions
Please see above examle.
Expected behavior (be clear and concise)
The header should be added and printed in the console log.
How is http-proxy-middleware used in your project?
What http-proxy-middleware configuration are you using?
What OS/version and node/version are you seeing the problem?
Additional context (optional)
No response