You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fiber version
github.com/gofiber/fiber/v2 v2.27.0 Issue description
I am invoking proxy.Do(c,proxy_url) inside a fiber handler. Inside the handler,
c.OriginalURL()
returns a non-immutable string due to zero allocation in fiber.
Now, when i pass the fiber context to the proxy.Do(ctx,addr), the originalURL is modified due to the setRequestURI inside proxy.go
Here is the code snippet showing this. Code snippet
From the browser try hitting localhost:3002/test two times. In the first occurrence, the results are expected due to zero allocation implementation of c.OriginalURL() method in fiber.
The above problem can be resolved by using the immutable method provided by the fiber utils to persist values.
Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
There was a similar issue raised and a fix was provided. However, I find that the fix provided won't work and the test is missing the essential edge case.
I think the methods proxy.Do() and sendFile() should restore the orginalURL() to avoid side effects which maybe caused in the original Handler.
Fiber version
github.com/gofiber/fiber/v2 v2.27.0
Issue description
I am invoking proxy.Do(c,proxy_url) inside a fiber handler. Inside the handler,
returns a non-immutable string due to zero allocation in fiber.
Now, when i pass the fiber context to the proxy.Do(ctx,addr), the originalURL is modified due to the setRequestURI inside proxy.go
Here is the code snippet showing this.
Code snippet
From the browser try hitting localhost:3002/test two times. In the first occurrence, the results are expected due to zero allocation implementation of c.OriginalURL() method in fiber.
The above problem can be resolved by using the immutable method provided by the fiber utils to persist values.
But c.OriginalURL() will still point to the URL of the proxy and not to the original handler.
here is the snippet.
Shouldn't the proxy.Do() method restore the context after hitting the proxy URL since the doc says that this method can be used in a. handler ?
The text was updated successfully, but these errors were encountered: