Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Copy original HTTP request headers, #175 #186

Closed
wants to merge 2 commits into from
Closed

Conversation

jwoyame
Copy link
Contributor

@jwoyame jwoyame commented Jan 10, 2015

This is a mild redesign of how client requests are forwarded in the .NET proxy. It provides a chance for request headers to be set through the new "copyRequestHeaders" function. This creates some flexibility for future modifications as well.

By copying headers from the client's request to the proxy's request, the proxy can now forward headers such as User-Agent, Cookie, Range, and so forth, which were formerly dropped by the proxy.

My personal need for this was to be able to properly handle PDF files. Clients such as Chrome will try to make partial range queries of PDF files if allowed by the server. Because we were copying response headers but not request headers, this created an issue where Chrome was told that it MAY make partial range requests, when in fact the requested range would get dropped. I confirmed that the .NET proxy is now able to handle partial byte ranges.

Handling partial content also meant that the proxy needs to be able to return a status code 206 (Partial Content). To allow for this, I modified the fetchAndPassBackToClient function to copy the server's response code as the proxy's response code.

@jgravois
Copy link
Contributor

thanks for this @jwoyame . we're a bit backlogged, but will review and provide more feedback shortly.

@cheetah90
Copy link
Contributor

This one has been fixed by #134 thus can be closed.

@bsvensson bsvensson closed this Aug 14, 2015
@jwoyame
Copy link
Contributor Author

jwoyame commented May 2, 2016

#134 passes response headers, however this change is meant to pass request headers as well.

@jwoyame jwoyame mentioned this pull request May 14, 2016
@bsvensson bsvensson reopened this Dec 6, 2016
@gavinr
Copy link
Contributor

gavinr commented Aug 11, 2017

@jgravois @bsvensson I'm having an issue where I'm using the proxy and the request headers are not being passed. I assume this PR resolves that - is there a reason it was never merged? Do we just need to resolve conflicts?

@bsvensson
Copy link
Member

@gavinr - If you/someone could resolve the conflicts, we can review again.

One thing to keep in mind is that not all headers should be passed along - see #362 - or not passed along as-is - see #384.

@bsvensson
Copy link
Member

bsvensson commented Aug 14, 2017

Closing this PR, but its changes lives on. See PR #433.

@bsvensson bsvensson closed this Aug 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants