2

I am trying to use Streaming API in SalesForce, which is basically implemented using Comet / Long Polling technology. In client, we're using Java with jetty-http , bayeux-api , cometd-java-client

Everything works perfectly if we run the application without proxy. But if client is using network proxy

A. it is able to do user authentication

B. long polling handshake is succesfull

C. meta/connect initially having 402 error (refer to below log) but eventually successful

D. NEVER get any response from server side

Any thought what's happening here, and why proxy caused this, even if all the HTTP connection request in A, B, C above are successful?

[12:23:50.504-HttpClient-21][CHANNEL:META_CONNECT]: {"id":"5","error":"402::Unknown client","successful":false,"advice":{"interval":500,"reconnect":"handshake"},"channel":"/meta/connect","clientId":"jj1ajqshe3lkkpp1rsiy5g30ppey"}
[12:23:50.504-HttpClient-21][CHANNEL:META_CONNECT] Error : 402::Unknown client
[12:23:51.760-HttpClient-23][CHANNEL:META_HANDSHAKE]: {"id":"6","minimumVersion":"1.0","supportedConnectionTypes":["long-polling"],"successful":true,"channel":"/meta/handshake","clientId":"ingkpdlgu6uy43m06ei30spqpl","version":"1.0"}
[12:23:53.170-HttpClient-19][CHANNEL:META_CONNECT]: {"id":"7","error":"402::Unknown client","successful":false,"advice":{"interval":500,"reconnect":"handshake"},"channel":"/meta/connect","clientId":"ingkpdlgu6uy43m06ei30spqpl"}
[12:23:53.170-HttpClient-19][CHANNEL:META_CONNECT] Error : 402::Unknown client
[12:23:54.408-HttpClient-22][CHANNEL:META_HANDSHAKE]: {"id":"8","minimumVersion":"1.0","supportedConnectionTypes":["long-polling"],"successful":true,"channel":"/meta/handshake","clientId":"fr1r22f6au89xpm1lbucrp26fs27","version":"1.0"}
[12:24:00.757-HttpClient-19][CHANNEL:META_CONNECT]: {"id":"9","successful":true,"advice":{"interval":0,"reconnect":"retry","timeout":110000},"channel":"/meta/connect","clientId":"fr1r22f6au89xpm1lbucrp26fs27"}
[12:24:07.051-HttpClient-19][CHANNEL:META_CONNECT]: {"id":"10","successful":true,"channel":"/meta/connect","clientId":"fr1r22f6au89xpm1lbucrp26fs27"}
[12:24:13.348-HttpClient-22][CHANNEL:META_CONNECT]: {"id":"11","successful":true,"channel":"/meta/connect","clientId":"fr1r22f6au89xpm1lbucrp26fs27"}
[12:24:19.643-HttpClient-18][CHANNEL:META_CONNECT]: {"id":"12","successful":true,"channel":"/meta/connect","clientId":"fr1r22f6au89xpm1lbucrp26fs27"}
[12:24:25.935-HttpClient-18][CHANNEL:META_CONNECT]: {"id":"13","successful":true,"channel":"/meta/connect","clientId":"fr1r22f6au89xpm1lbucrp26fs27"}
[12:24:33.429-HttpClient-24][CHANNEL:META_CONNECT]: {"id":"14","successful":true,"channel":"/meta/connect","clientId":"fr1r22f6au89xpm1lbucrp26fs27"}
iwan
  • 7,269
  • 18
  • 48
  • 66
  • Same here. I was using mitmproxy to explore another app using cometd and buffering had to be disabled in order for it to work properly. You might also need to import a proxy ca source into the ssl trusted CAs if the app enforces identity verification in TLS. – Raymond Ferguson Dec 23 '17 at 16:06

1 Answers1

0

It may be the case that the proxy is buffering the response. It happens e.g. with nginx and proxy_buffering on directive.

Artur Nowak
  • 5,254
  • 3
  • 22
  • 32
  • Hi I am experiencing the same issue here with Grizzly Comet implementation with Glassfish 4.1. This is the only question and answer that clearly describes the problem and a possible solution. How do I turn off proxy_buffering directive on Glassfish? Thanks in advance. – qualebs Jan 05 '18 at 20:23
  • @qualebs this applies if you have some proxy in front of Glassfish – Artur Nowak Jan 07 '18 at 11:06