titanium-web-proxy
                                
                                 titanium-web-proxy copied to clipboard
                                
                                    titanium-web-proxy copied to clipboard
                            
                            
                            
                        Unable to set custom host
While rewriting a request one can't set a custom host header independent from the request url.
Meaning, either through
session.HttpClient.Request.Host = "custom.host.com"
or
session.HttpClient.Request.Headers.AddHeader("Host", "custom.host.com")
this won't ever send Host: custom.host.com as a header because request.Host is being overridden by Request.RequestUriString and by the RequestHandler itself.
I guess my question is, how do we do this:
GET https://absolute.resource.com/path.png HTTP/1.1
Host: custom.host.com
GET https://absolute.resource.com/path.png HTTP/1.1
Host: another.host.com
We serve different hosts on the same server and this way we can't differentiate between them. Also this is a normal scenario when the server has a proxy in front of it.
Is this intentional? I understand something different by reading the RFC:
The Host field value MUST represent the naming authority of the origin server or gateway given by the original URL. This allows the origin server or gateway to differentiate between internally-ambiguous URLs, such as the root "/" URL of a server for multiple host names on a single IP address.
I might be reading it wrong. Any guidance here? I know this worked before and now we are stuck on an old package version simply because of this.
Available to open a PR if that's the case. Thank you!
Please open a PR.
While rewriting a request one can't set a custom host header independent from the request url.
Meaning, either through
session.HttpClient.Request.Host = "custom.host.com"orsession.HttpClient.Request.Headers.AddHeader("Host", "custom.host.com")this won't ever send
Host: custom.host.comas a header becauserequest.Hostis being overridden byRequest.RequestUriStringand by theRequestHandleritself.I guess my question is, how do we do this:
GET https://absolute.resource.com/path.png HTTP/1.1 Host: custom.host.comGET https://absolute.resource.com/path.png HTTP/1.1 Host: another.host.comWe serve different hosts on the same server and this way we can't differentiate between them. Also this is a normal scenario when the server has a proxy in front of it.
Is this intentional? I understand something different by reading the RFC:
The Host field value MUST represent the naming authority of the origin server or gateway given by the original URL. This allows the origin server or gateway to differentiate between internally-ambiguous URLs, such as the root "/" URL of a server for multiple host names on a single IP address.
I might be reading it wrong. Any guidance here? I know this worked before and now we are stuck on an old package version simply because of this.
Available to open a PR if that's the case. Thank you!
I seem to have the same problem. Can you tell me how you solve this problem?
I seem to have the same problem. Can you tell me how you solve this problem?
I didn't. Just pinned this package's version to one that it's working (3.0.632) and currently moving on to other approaches that don't require it at all. The package is too buggy and unfortunately we don't have the time or bandwidth too work on it.