Skip to content

ForwardedParser calculates invalid absolute URI when request target is already absolute #2830

Closed

Description

@tmonney

Version

4.5.22, but the code is the same in the main branch

Context

Absolute request URIs are not computed correctly by HttpServerRequestWrapper class when the target is
absolute. For example, with this request:

GET http://localhost:8080/hello HTTP/1.1
Host: some.random.host.com:9876

The io.vertx.ext.web.impl.HttpServerRequestWrapper#absoluteURI() method returns http://some.random.host.com:9876http://localhost:8080/hello, which is obviously wrong.

I would expect the result to be one of

  • http://localhost:8080/hello
  • http://some.random.host.com:9876/hello

The problem seems to be caused by [ForwardedParser#calculate()](https://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/java/io/vertx/ext/web/impl/ForwardedParser.java#L136):

if (host != null) {
  this.authority = HostAndPort.create(host, port);
  host = host + (port >= 0 ? ":" + port : "");
  absoluteURI = scheme + "://" + host + delegate.uri();
}

Here delegate.uri() is already absolute, and is just appended as-is.

Steps to reproduce

Clone the reproducer and run mvn:test. The tests should pass, they are actually "verifying" the current faulty behavior.

Do you have a reproducer?

https://github.com/tmonney/vertx-web-absolute-uri

Activity

  1. added theissue type on Nov 26, 2025
  2. added this to the 4.5.23 milestone on Nov 27, 2025
  3. tsegismont commented on Nov 27, 2025

    @tsegismont
    Member

    Thanks for the report @tmonney ! Would you like to contribute a fix?

  4. tmonney commented on Dec 1, 2025

    @tmonney
    ContributorAuthor

    I can give it a try, yes

  5. added a commit that references this issue on Dec 2, 2025
    a800296
  6. tmonney commented on Dec 12, 2025

    @tmonney
    ContributorAuthor

    @tsegismont , did you have a chance to have a look?

  7. modified the milestones: 4.5.23, 4.5.24 on Dec 15, 2025
  8. added a commit that references this issue on Jan 13, 2026
    97039b2
  9. modified the milestones: 4.5.24, 4.5.25 on Jan 15, 2026
  10. self-assigned this
    on Jan 15, 2026
  11. added a commit that references this issue on Jan 21, 2026
    586338e
  12. added 3 commits that reference this issue on Jan 23, 2026
    b1a6fc9
    d8c261d
    68a74f1
  13. tsegismont commented on Jan 23, 2026

    @tsegismont
    Member

    Fixed by #2842

  14. added 2 commits that reference this issue on Jan 23, 2026
    a1f79d4
    5ec7457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions