IHttpRequest headers overwritten in HTML5 build

I am using the FHttpModule to communicate with a remote service. The payload is json and the remote service requires http basic authentication. The communication works fine in the editor and windows deployment, but does not work when deployed to HTML5.

Upon inspecting the request, I found that the header values were not being set. The Authorization header was absent and the content-type was set to application/x-www-form-urlencoded; charset=UTF-8.

The request code is pretty straight forward:

TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
HttpRequest->SetHeader(TEXT("Authorization"), AuthString);

The remote service has a different host name than the one hosting the game files, but it can handle CORS. When I use the browser to manually change the content-type and add the Authorization header, the browser correctly negotiates the CORS preflight.

Is there something that I am doing (or not doing) to cause the headers to be overwritten?

Edit: Forgot to mention that I am using version 4.7.3.

I have verified this and its a bug. UE-13069 has been created to track this.

Thank you!

Hey ,

The issue you were experiencing should be resolved with: https://github.com/EpicGames/UnrealEngine/commit/3493522c66c5e45ad98f53042dca1313ac17dc90 - however, if you’re using GitHub distribution, please make sure you selectively merge this check-in otherwise you’ll need to wait for 4.8.


Many thanks!