Hi,
I am trying to query EventStore from our AngularJS app but I’m receiving the following error…
XMLHttpRequest cannot load XXXX. Request header field X-JourneyMan-Id is not allowed by Access-Control-Allow-Headers.
The X-JourneyMan-Id value in the header is something that we use to track information through our system so needs to be in our request message. Is there a way to update the accepted headers list in EventStore?
Thanks
Luke
You could do this easily with a proxy such as nginx/iis/etc
jen20
August 19, 2014, 2:11pm
3
Hi,
If you’re building from source you can change the list of accepted headers here:
{
Log.ErrorException(e, "Attempt to set invalid value '{0}' as content length.", length);
}
}
private void SetRequiredHeaders()
{
try
{
HttpEntity.Response.AddHeader("Access-Control-Allow-Methods", string.Join(", ", _allowedMethods));
HttpEntity.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, X-Requested-With, X-PINGOTHER, Authorization, ES-LongPoll, ES-ExpectedVersion");
HttpEntity.Response.AddHeader("Access-Control-Allow-Origin", "*");
HttpEntity.Response.AddHeader("Access-Control-Expose-Headers", "Location, ES-Position");
if (HttpEntity.Response.StatusCode == HttpStatusCode.Unauthorized)
HttpEntity.Response.AddHeader("WWW-Authenticate", "Basic realm=\"ES\"");
}
catch (ObjectDisposedException)
{
// ignore
}
catch (Exception e)
I guess there’s enough interest changing this from the outside that we should make it configurable - I’ll put up a GitHub issue to discuss.
James
I could look to do a PR for this James as we already build from dev branch.
In the meantime we’ll route it via our existing nginx reverse proxy and neuritalise the header
Cheers, Ian.
The issue is what other uris do you want various headers associated to?