Skip to content

Fix request absolute URI handling#2833

Merged
tsegismont merged 2 commits intovert-x3:masterfrom
tmonney:fix-2830-absolute-uri
Jan 23, 2026
Merged

Fix request absolute URI handling#2833
tsegismont merged 2 commits intovert-x3:masterfrom
tmonney:fix-2830-absolute-uri

Conversation

@tmonney
Copy link
Copy Markdown
Contributor

@tmonney tmonney commented Dec 2, 2025

When a request uses an absolute request target with scheme and host parts, the current absoluteURI() method simply concatenates the Host header value and the request target URI. For example, with the following request:

GET http://www.example.com:1234/path HTTP/1.1
Host: www.example.com:1234

The result of HttpServerRequest.absoluteURI() would then be:

http://www.example.com:1234www.example.com:1234/path

With this change, when the request target is absolute, only the path (and query) are added to the Host value:

http://www.example.com:1234/path

Fixes #2830

Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a compilation problem. Can you take a look?

@vietj
Copy link
Copy Markdown
Contributor

vietj commented Jan 7, 2026

@tmonney

@tmonney tmonney force-pushed the fix-2830-absolute-uri branch from a800296 to 97039b2 Compare January 13, 2026 13:39
@tmonney
Copy link
Copy Markdown
Contributor Author

tmonney commented Jan 13, 2026

@vietj @tsegismont sorry, I was quite busy before the holidays, then busy during the holidays, and of course even more busy after the holidays...
The silly compilation errors should be gone now, I don't even know how I did not notice that...

@tsegismont
Copy link
Copy Markdown
Member

We have issues in Vert.x Web build right now because of the recent updates in Vert.x core for HTTP/3

I'll come back to this when they are resolved. Thanks for the heads-up

@tsegismont
Copy link
Copy Markdown
Member

Could you please rebase the PR ?

When a request uses an absolute request target with scheme and host
parts, the current absoluteURI() method simply concatenates the Host
header value and the request target URI. For example, with the following
request:

```
GET http://www.example.com:1234/path HTTP/1.1
Host: www.example.com:1234
```

The result of HttpServerRequest.absoluteURI() would then be:

`http://www.example.com:1234www.example.com:1234/path`

With this change, when the request target is absolute, only the path
(and query) are added to the Host value:

`http://www.example.com:1234/path`

Fixes vert-x3#2830
@tmonney tmonney force-pushed the fix-2830-absolute-uri branch from 78f9172 to 586338e Compare January 21, 2026 12:10
Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @tmonney

Comment thread vertx-web/src/main/java/io/vertx/ext/web/impl/ForwardedParser.java Outdated
Copy link
Copy Markdown
Member

@tsegismont tsegismont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tmonney !

@tsegismont tsegismont merged commit b1a6fc9 into vert-x3:master Jan 23, 2026
7 checks passed
@tsegismont tsegismont added this to the 5.1.0 milestone Jan 23, 2026
tsegismont added a commit to tsegismont/vertx-web that referenced this pull request Jan 23, 2026
* Fix request absolute URI handling

When a request uses an absolute request target with scheme and host
parts, the current absoluteURI() method simply concatenates the Host
header value and the request target URI. For example, with the following
request:

```
GET http://www.example.com:1234/path HTTP/1.1
Host: www.example.com:1234
```

The result of HttpServerRequest.absoluteURI() would then be:

`http://www.example.com:1234www.example.com:1234/path`

With this change, when the request target is absolute, only the path
(and query) are added to the Host value:

`http://www.example.com:1234/path`

Fixes vert-x3#2830

* Update vertx-web/src/main/java/io/vertx/ext/web/impl/ForwardedParser.java

---------

Co-authored-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit to tsegismont/vertx-web that referenced this pull request Jan 23, 2026
* Fix request absolute URI handling

When a request uses an absolute request target with scheme and host
parts, the current absoluteURI() method simply concatenates the Host
header value and the request target URI. For example, with the following
request:

```
GET http://www.example.com:1234/path HTTP/1.1
Host: www.example.com:1234
```

The result of HttpServerRequest.absoluteURI() would then be:

`http://www.example.com:1234www.example.com:1234/path`

With this change, when the request target is absolute, only the path
(and query) are added to the Host value:

`http://www.example.com:1234/path`

Fixes vert-x3#2830

* Update vertx-web/src/main/java/io/vertx/ext/web/impl/ForwardedParser.java

---------

Co-authored-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit that referenced this pull request Jan 23, 2026
* Fix request absolute URI handling

When a request uses an absolute request target with scheme and host
parts, the current absoluteURI() method simply concatenates the Host
header value and the request target URI. For example, with the following
request:

```
GET http://www.example.com:1234/path HTTP/1.1
Host: www.example.com:1234
```

The result of HttpServerRequest.absoluteURI() would then be:

`http://www.example.com:1234www.example.com:1234/path`

With this change, when the request target is absolute, only the path
(and query) are added to the Host value:

`http://www.example.com:1234/path`

Fixes #2830

* Update vertx-web/src/main/java/io/vertx/ext/web/impl/ForwardedParser.java

---------

Co-authored-by: Thierry Monney <thierry.monney@gmail.com>
tsegismont added a commit that referenced this pull request Jan 23, 2026
* Fix request absolute URI handling

When a request uses an absolute request target with scheme and host
parts, the current absoluteURI() method simply concatenates the Host
header value and the request target URI. For example, with the following
request:

```
GET http://www.example.com:1234/path HTTP/1.1
Host: www.example.com:1234
```

The result of HttpServerRequest.absoluteURI() would then be:

`http://www.example.com:1234www.example.com:1234/path`

With this change, when the request target is absolute, only the path
(and query) are added to the Host value:

`http://www.example.com:1234/path`

Fixes #2830

* Update vertx-web/src/main/java/io/vertx/ext/web/impl/ForwardedParser.java

---------

Co-authored-by: Thierry Monney <thierry.monney@gmail.com>
@tmonney
Copy link
Copy Markdown
Contributor Author

tmonney commented Jan 26, 2026

@tsegismont thanks for finishing the work, and sorry I was not more responsive!

@tsegismont
Copy link
Copy Markdown
Member

No problem, thank you for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ForwardedParser calculates invalid absolute URI when request target is already absolute

3 participants