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
When establishing a Server-Sent Events (SSE) connection through Proxyman, all headers originally sent by the server are missing from the response. Instead, Proxyman appears to replace them with its own headers (for example, adding Transfer-Encoding: chunked and omitting the original Content-Type: text/event-stream). Because OkHttp-SSE depends on the Content-Type: text/event-stream header to process SSE, the connection cannot be established while the proxy is enabled.
Steps to Reproduce
I wrote a simple Node.js program to demonstrate the erroneous behavior, replicating the headers used by a real client-server application. To confirm that the problem wasn’t due to a specific server or client, I used low-level mechanisms—like raw sockets—to verify that everything worked as expected.
consthttp=require('http');consturl=require('url');constnet=require('net');constserver=net.createServer((socket)=>{constheaders=['HTTP/1.1 200 OK','server: nginx/1.26.1','date: Wed, 29 Jan 2025 15:37:11 GMT','content-type: text/event-stream','connection: Keep-Alive','cache-control: no-cache','some-custom-header: test','',''].join('\r\n');socket.write(headers);letcounter=0;constintervalId=setInterval(()=>{socket.write(`data: Event ${counter++}\r\n\r\n`);},1000);socket.on('close',()=>clearInterval(intervalId));});server.listen(8081,()=>{console.log('SSE server running on port 8081');});functionstartClient(targetUrl){constproxy={hostname:'192.168.0.9',port: 9091};constoptions={protocol: 'http:',hostname: proxy.hostname,port: proxy.port,path: targetUrl,headers: {'Host': 'localhost:8081','Connection': 'Keep-Alive','Accept': 'text/event-stream','Accept-Encoding': 'gzip','User-Agent': 'okhttp/4.12.0'}};constreq=http.request(options,(res)=>{Object.entries(res.headers).forEach(([key,value])=>{console.log(`${key}: ${value}`);});});req.end();}startClient('http://localhost:8081/events');
Current Behavior
When running through proxy, the program output is as follows:
Furthermore, SSE doesn't work in Postman or in the browser when the proxy is enabled.
AlexanderShirokih
changed the title
Proxyman removes all original response headers on Server-Sents event connections
Proxyman removes all original response headers on Server-Sent event connections
Jan 30, 2025
Description
When establishing a Server-Sent Events (SSE) connection through Proxyman, all headers originally sent by the server are missing from the response. Instead, Proxyman appears to replace them with its own headers (for example, adding Transfer-Encoding: chunked and omitting the original Content-Type: text/event-stream). Because OkHttp-SSE depends on the Content-Type: text/event-stream header to process SSE, the connection cannot be established while the proxy is enabled.
Steps to Reproduce
I wrote a simple Node.js program to demonstrate the erroneous behavior, replicating the headers used by a real client-server application. To confirm that the problem wasn’t due to a specific server or client, I used low-level mechanisms—like raw sockets—to verify that everything worked as expected.
Current Behavior
When running through proxy, the program output is as follows:
No
Content-type
, and all the other headers, but in the Proxyman window, I see that the server is sending the correct headers.Expected Behavior
When Proxyman is on, the orignal headers are kept in the proxy output.
Environment
Proxyman Version 2.19.0 (21900) | Linux (Build 6.11.0-14-generic)
The text was updated successfully, but these errors were encountered: