air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
16.32k stars 770 forks source link

Fix: Proxy return redirect response #586

Closed reginbald closed 1 month ago

reginbald commented 1 month ago

What has been changed

Configures proxy to not follow redirects and return to the client the actual response from the server.

Why?

Current proxy solution "follows" redirect responses from the server and makes an additional request rather then returning the redirect response to the client.

Example Scenario

Client issues a delete request and the server returns a See Other redirect response. Current proxy solution does not return the response but follows the redirect response, makes another request and then returns that response to the client.

Before the change:

image image

After the change:

image image
reginbald commented 1 month ago

Hey @cosmtrek, @ndajr or @xiantang do you have time to review this PR? Any thoughts?

ndajr commented 1 month ago

Hi @reginbald, sorry for the delay. Looks good to me! I will try to reach @xiantang and see if we can release these three PRs together in the next minor release:

xiantang commented 1 month ago

Tks. well done