Discussion:
[akka-user][deprecated] akka-http: "Illegal 'content-type' header"
Felix Nensa
2018-11-29 11:37:21 UTC
Permalink
Hi,

I have a small akka-http app that under some circumstances works as a proxy
and just passes data from another (non-akka) HTTP server to the client.
It basically does something like this:

final Flow<HttpRequest, HttpResponse, CompletionStage<OutgoingConnection>>
flow =
Http.get(system).outgoingConnection(ConnectHttp.toHost("localhost", 8042
));

final HttpRequest request = ctx.getRequest()
.withUri("/path/to/remote/resource")
.addCredentials(BasicHttpCredentials.createBasicHttpCredentials("me",
"secret"));

final CompletionStage<HttpResponse> csr =
Source.single(request)
.via(flow)
.runWith(Sink.<HttpResponse>head(), materializer);

return completeWithFuture(csr);

While this in general works, akka-http seems to have issues with the
Content-Type header that is sent by the other HTTP server.
As a result the client sees a "Content-Type: application/octet-stream"
which akka probably generates by default due to the parsing error.

WARN akka.actor.ActorSystemImpl - Illegal header: Illegal 'content-type'
header: Invalid input '/', expected tchar, OWS, ws or 'EOI' (line 1, column
36): multipart/related; type=application/dicom;
boundary=56502BE3-C49F-4FDF-94B1-C0D1AFD87DEF
WARN akka.actor.ActorSystemImpl - Explicitly set HTTP header
'content-type: multipart/related; type=application/dicom;
boundary=56502BE3-C49F-4FDF-94B1-C0D1AFD87DEF' is ignored, illegal RawHeader

How can I tell akka-http to just pass the headers untouched to the client?

Thanks, Felix
--
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user google-group soon.
** This group will soon be put into read-only mode, and replaced by discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
Read the docs: http://akka.io/docs/
Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+***@googlegroups.com.
To post to this group, send email to akka-***@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Loading...