Hi Frederic,

ports in Host headers should be fine 
(see http://tools.ietf.org/html/rfc7230#section-5.4) and be supported by 
akka-http. Just make shure that both host and port of the request URI are 
the same as in the Host header.

The port checking seems to currently be missing. Therefore I 
filed https://github.com/akka/akka/issues/18632.

Cheers
André

On Friday, October 2, 2015 at 12:17:48 PM UTC+2, Akka Team wrote:
>
> HI Fred,
>
> I am not sure, but does the Host header allow ports to be defined? I am 
> not sure what the RFC says on this matter, but Akka Http (and Spray) tends 
> to follow the rules by-the-book most of the time.
>
> -Endre
>
> On Mon, Sep 28, 2015 at 8:50 PM, Frederic Masion <[email protected] 
> <javascript:>> wrote:
>
>> 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
>>
>> -- 
>> >>>>>>>>>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Akka Team
> Typesafe - Reactive apps on the JVM
> Blog: letitcrash.com
> Twitter: @akkateam
>

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to