Skip to content

Roundrobin overwrites request URL #40

Open

Description

@mikaelnousiainen

It seems that using roundrobin in a way that is similar to the example in README does not work correctly -- or at least it does not work the way I expect it to.

We have the following code:

fwd, _ := forward.New()
lb, _ := roundrobin.New(fwd)

lb.UpsertServer(url1)
lb.UpsertServer(url2)

s := &http.Server{
    Addr:           ":8080",
    Handler:        lb,
}
s.ListenAndServe()

Where:

Let's consider the following scenario:

  1. Server receives request: http://server/path/to/a/file.txt
  2. Roundrobin gets a suitable server from the list using code and sets the URL for forwarder in: https://github.com/vulcand/oxy/blob/master/roundrobin/rr.go#L72
  3. The URL for forwarder is either: "http://backend1:8080/" or "http://backend2:8080/", while I would have expected it to be: "http://backendN:8080/path/to/a/file.txt"

I cannot see how the code is supposed to be used to achieve a trivial reverse proxy setup.

Is there something I've missed? :)

Activity

  1. mikaelnousiainen commented on Apr 4, 2016

    @mikaelnousiainen
    Author

    Ok, I found out that forward uses RequestURI to replace url.Opaque, but in this case the RequestURI should contain also the host, which is not the case, so I still don't understand how this is supposed to work considering the following:

    "RequestURI is the unmodified Request-URI of the Request-Line (RFC 2616, Section 5.1) as sent by the client".

    Additionally, URL.String() ends up with scheme:opaque?query#fragment.

  2. lunemec commented on Jan 19, 2017

    @lunemec

    This is dupliacte with #57. This issue was first, but the #57 has some proposed solutions. This should be closed as dupliacte and solved there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions