Closed omatrot closed 5 years ago
do you have any other server or may be Office 365 mailbox to test against? may be specific issue with exchange.
Unfortunately no. I asked my client to see if it could see the incoming requests in the logs though.
May be you can take a look at these issues Error: socket hang up #2047 and http.Agent: idle sockets throw unhandled ECONNRESET. This may be tied to Node.js.
My customer is investigating a potential firewall issue.
I am using different library. for investigation and testing you can modify XHRDefaults
with http/s agent keepAlive
options. you have to modify line https://github.com/gautamsi/ews-javascript-api/blob/6fa705079141a9ea5ce76d877a132d86d2bad1ca/src/js/XHRDefaults.ts#L17 and https://github.com/gautamsi/ews-javascript-api/blob/6fa705079141a9ea5ce76d877a132d86d2bad1ca/src/js/XHRDefaults.ts#L64 and add agentHTTPS option, see https://github.com/andris9/fetch#options, you can change corresponding js file instead of building it from source.
Adding
agentHttps: xhroptions.agentHttps,
has no effect...
This is probably a backend firewall issue.
xhroptions has no agentHttps property. in js file you want to do like this.
const https = require('https');
const keepAliveAgent = new https.Agent({ keepAlive: true });
// .... other lines
agentHttps: keepAliveAgent,
I've used an alternate method to set the header, still the same problem. I'll wait for an answer from my customer regarding their firewall.
FYI, the equivalent .NET Code run on Windows does not suffer this problem. This is defintely tied to the context of my Customer because I'm running it without error against an Office 365 system.
I've used fiddler to see what's going on underneath. The first request to the service fails with a HTTP 401 (Unauthorized). But the response hearders contains a cookie:
Set-Cookie: exchangecookie=44b8fffe783c4e00a95554cae1f27651; expires=Wed, 16-Jan-2019 12:24:30 GMT; path=/; HttpOnly
The .NET client tries again with another request that include the cookie header received from the first call:
Cookie: exchangecookie=44b8fffe783c4e00a95554cae1f27651
This time it works. I have a response back. Full Headers (minus HOST) in first request:
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0913.015
Accept-Encoding: gzip,deflate
Content-Length: 3369
Expect: 100-continue
Connection: Keep-Alive
Second one:
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0913.015
Accept-Encoding: gzip,deflate
Authorization: Basic VGVzdEJQX1VzZXIxQGdyb3VwYW1hLWltbW9iaWxpZXIuZnI6RWx5c2Vlc0Ax
Cookie: exchangecookie=44b8fffe783c4e00a95554cae1f27651
Content-Length: 3369
Expect: 100-continue
I'll try with Fiddler Mac to see what's going on exactly with the Javascript API.
what is the authentication mode set on EWS Virtual Directory?
I'll have to ask.
you can test add cookie jar support used in fetch if cookies is a problem.
this may have changed in latest Exchange Patch or so, had not seen this as issue unless you are running behind reverse proxy of some kind.
Your right. My Customer tells me that there is an ISA server (reverse proxy) between us and the IIS Server. They'll try to let us through by modifying the configuration.
what authentication is being used for ISA? if it is allowed to bypass login by ISA (usual case with latest exchange) you should use basic authentication (included in ews-javascript-api). if they have published EWS over Form based Authentication, You have to use cookieAuthXhrApi in ews-javascript-api-auth
EWS seems to be published over Form based Authentication because we are indeed redirected to a login form when testing the EWS url in a browser.
must use cookieAuthXhrApi
I'll try that tonight, thanks.
Unfortunately it does not work. I have the same error message.
ping me on gitter
issue is with cipher used in https/tls, could be specific to site you are using. this helped me troubleshoot further https://github.com/nodejs/node/issues/9845
I have to update cookie auth api with additional option, like for HttpAgent pass through to underlying api
great news !
there is no need to update anything here, this is how it should be used
import { XhrApi } from "@ewsjs/xhr"
const xhrApi = new XhrApi({ agentOptions: { ciphers: "DES-CBC3-SHA" } })
ewsService.xhrApi = xhrApi; // or ews.ConfigurationApi.ConfigureXHR(xhrApi)
agentOptions
are passed to tls tunnel creation.
Environment: EWS Exchange 2010
The following typescript code fails with "socket hang up" error:
Not sure which side is the problem located...
EWS logging:
Any help appreciated.