You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jo...@ventusproxy.com on 2024/01/24 15:48:56 UTC

Getting wrong value calling request.getScheme()

Hello,

 

Tomcat 10.1.18 with jakarta servlet 6, embedded in our app using jdk17. I
have the following class:

 

public Url(jakarta.servlet.http.HttpServletRequest request){

  System.out.println("this.scheme = '" + request.getScheme() + "'");

  System.out.println("this.protocol = '" + request.getProtocol() + "'");

  System.out.println("this.requestURL = '" + request.getRequestURL() + "'");

}

 

This method prints:

this.scheme = 'HTTP/1.1'

this.protocol = 'HTTP/1.1'

this.requestURL = 'HTTP/1.1://127.0.0.1/derbysoft/multipleavailability'

 

I tried with a couple of jdk17 (openJDK and Zulu) and the result is the
same.

 

Not sure if this a bug or a change in the servlet specification, but it
seems not to be this:

 

https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakart
a/servlet/servletrequest#getScheme()

String getScheme()

Returns the name of the scheme used to make this request, for example, http,
https, or ftp. Different schemes have different rules for constructing URLs,
as noted in RFC 1738.

Returns:

a String containing the name of the scheme used to make this request

 

 

Any help would be really appreciated.

 

Thanks,

 

Joan.


RE: Getting wrong value calling request.getScheme()

Posted by jo...@ventusproxy.com.
Yes ... Thanks.

-----Original Message-----
From: Mark Thomas <ma...@apache.org> 
Sent: Wednesday, January 24, 2024 5:39 PM
To: users@tomcat.apache.org
Subject: Re: Getting wrong value calling request.getScheme()

On 24/01/2024 15:48, joan.balaguero@ventusproxy.com wrote:

<snip/>

> Any help would be really appreciated.

Configuration error.

Someone has done the equivalent of <Connector ... scheme="HTTP/1.1" />

Or possibly a mis-configured RemoteIpFilter (or Valve).

Or similar.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting wrong value calling request.getScheme()

Posted by Mark Thomas <ma...@apache.org>.
On 24/01/2024 15:48, joan.balaguero@ventusproxy.com wrote:

<snip/>

> Any help would be really appreciated.

Configuration error.

Someone has done the equivalent of <Connector ... scheme="HTTP/1.1" />

Or possibly a mis-configured RemoteIpFilter (or Valve).

Or similar.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org