Hi everybody,
I have a strange IllegalUriException with akka-http :
My app is quite simple : a logging proxy
I have configured my network to use this proxy for all http requests.
what the proxy does :
val route: Route =
logging {
{
forward
}
}
Http().bindAndHandle (route, "localhost", 8181)
logging directive only extracts method, path... and logs it
to forward Route is defined here :
trait Forwader {this : ProxyDirective =>
def forward : StandardRoute =
StandardRoute { (context: RequestContext) =>
val future = Http().singleRequest(context.request)
future.fast.transformWith {
case Success(res) ⇒ context.complete(res)
case Failure(error) ⇒ context.complete(StatusCodes.InternalServerError, s"An error occurred: ${error.getMessage}")
}
}
}
Everything is very basic and works fine with default port BUT I have plenty of ERROR logs like this one :
[ERROR] [09/28/2015 20:38:26.583] [Proxy-akka.actor.default-dispatcher-283] [ActorSystem(Proxy)] Internal server error, sending 500 response
akka.http.scaladsl.model.IllegalUriException: 'Host' header value of request to `notify1.dropbox.com:443` doesn't match request target authority: Host header: Some(Host:
notify1.dropbox.com)
[ERROR] [09/28/2015 20:46:21.163] [Proxy-akka.actor.default-dispatcher-386] [ActorSystem(Proxy)] Internal server error, sending 500 response
akka.http.scaladsl.model.IllegalUriException: 'Host' header value of request to `openoox.com:8080` doesn't match request target authority: Host header: Some(Host:
openoox.com:8080)
request target authority:
Has soon as the HOST header of the response contains a port with the http protocol I have a IllegalUriException
Did I missed something ?
Fred