Edit: Fixed. To see what was wrong take a look at this.
When I try to send a request to a FastHttp server with an Authorization header, the header gets removed. When I send a request with Postman, the Authorization header does not get removed.
To see what headers are actually sent I set up a Undertow web server (Java) and sent my requests to that server.
Code of the Java webserver:
Undertow undertow = Undertow.builder().addHttpListener(55446, "localhost", new HttpHandler() {
public void handleRequest(final HttpServerExchange httpServerExchange) throws Exception {
System.out.println("------------------------------------------");
System.out.println("Con from "+httpServerExchange.getHostName());
System.out.println("Query "+httpServerExchange.getQueryString());
System.out.println("Header "+httpServerExchange.getRequestHeaders().getHeaderNames().stream().map(str -> str.toString()+": "+httpServerExchange.getRequestHeaders().get(str).element()).collect(Collectors.joining("; ")));
httpServerExchange.getRequestReceiver().receiveFullString((httpServerExchange1, s) -> System.out.println("Body "+s));
httpServerExchange.setStatusCode(400);
}
}).build();
undertow.start();
Output when I send the request with Postman:
------------------------------------------
Con from localhost
Query
Header Accept: */*; Postman-Token: 275ba9bb-77cc-4c9f-baa5-653f60162551; Connection: keep-alive; Authorization: Bearer xxxxxxxxxxxxxxxxxxxxx; Cache-Control: no-cache; Accept-Encoding: gzip, deflate; User-Agent: PostmanRuntime/7.21.0; Host: localhost:55446
Body
Output when I send the request with my application:
------------------------------------------
Con from localhost
Query
Header test: f; Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml; Authorization: Bearer testtoken; Accept-Encoding: gzip, deflate; User-Agent: VSpedSync/DevBuild; Host: localhost:55446
Body
In both cases the Authorization header is sent, but when I send the requests to the FastHttp server only the one from Postman contains the header.
Im so confused, why exactly is this happening?