Base URL showing http instead of https when SSL is enabled

36 views
Skip to first unread message

Avinash Kumar Sahu

unread,
Aug 4, 2018, 12:05:26 AM8/4/18
to RestExpress

Hi, I am running the RestExpress in SSL mode using


server.setSSLContext(context);


Everything is working fine except that when Making https requests, the base URL shows http


Example:
$ curl -k https://localhost:8080
"Unresolvable URL: http://localhost:8080/"


The response is correct but URL returned in the message is http instead of https. Any quick fix to get around this ?

Todd Fredrich

unread,
Dec 24, 2018, 2:39:45 PM12/24/18
to RestExpress
Hmm... that base URL essentially boils down to a call of Request.getProtocol() which looks like this:
/**
* Get the protocol of the request.
*
* @return "http" or "https," etc. lower-case.
*/
public String getProtocol()
{
return httpRequest.protocolVersion().protocolName().toLowerCase();
}
And depends on Netty's FullHttpRequest. I expect RestExpress is not utilizing it correctly, but protocolName() probably always returns HTTP. The workaround would be to override Request.getProtocol() or fix that method...
Reply all
Reply to author
Forward
0 new messages