Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebClient uses absolute request URI in requests #2302

Closed
cdivita opened this issue Aug 31, 2020 · 3 comments · Fixed by #2309
Closed

WebClient uses absolute request URI in requests #2302

cdivita opened this issue Aug 31, 2020 · 3 comments · Fixed by #2309
Assignees
Labels
2.x Issues for 2.x version branch SE webclient

Comments

@cdivita
Copy link

cdivita commented Aug 31, 2020

Environment Details

  • Helidon Version: 2.0.1
  • Helidon SE
  • JDK version: 11.0.4
  • OS: any
  • Docker version (if applicable): N/A

Problem Description

Helidon WebClient uses an absolute request URI rather than a relative one when submitting HTTP requests. Most of times this is not an issue, but there are some HTTP server implementation that are not able to deal with it.

For example, due to this issue using Helidon WebClient I'm not able to get an OAuth Token from Oracle Identity Cloud because my requests fail with a 404.

The requests issued by Helidon WebClient look like the following:

POST <idcs-host>/oauth2/v1/token HTTP/1.1
Accept: text/plain
Accept: application/json
Content-Type: application/x-www-form-urlencoded
host: <idcs-host>
user-agent: Helidon/2.0.1 (java 11.0.4+10-LTS)

While instead the expected format should be:

POST /oauth2/v1/token HTTP/1.1
Accept: text/plain
Accept: application/json
Content-Type: application/x-www-form-urlencoded
host: <idcs-host>
user-agent: Helidon/2.0.1 (java 11.0.4+10-LTS)

Section 5 of RFC 2116 is a bit ambiguous about the Request-URI format responsibilities:

To allow for transition to absoluteURIs in all requests in future versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies.

To avoid such kind of issues, the Helidon WebClient should used absolute URI only when effectively required, or make this behavior configurable.

Steps to reproduce

To verify the Request-URI format used by the Helidon Web Client, just enable the logging at finest level to see the request issued towards the HTTP server

@Verdent
Copy link
Member

Verdent commented Sep 1, 2020

Hi @cdivita , thank you for reporting this issue.

@cdivita
Copy link
Author

cdivita commented Sep 1, 2020

Hi @cdivita , thank you for reporting this issue.

Thanks to you @Verdent for the quick fix !!!

I was wondering if when a proxy is configured the previous behavior should be kept...

@Verdent
Copy link
Member

Verdent commented Sep 2, 2020

@cdivita Great point, thank you! If no proxy is set, relative path is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issues for 2.x version branch SE webclient
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants