Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing headers to work with other web servers and systems #257

Open
Starystars67 opened this issue Jun 11, 2020 · 3 comments
Open

Removing headers to work with other web servers and systems #257

Starystars67 opened this issue Jun 11, 2020 · 3 comments

Comments

@Starystars67
Copy link

Starystars67 commented Jun 11, 2020

Hello,

So I am having a bit of an issue with redbird proxy and trying to make it work with the following project: plan-player-analytics/Plan#1488 .
So first a little background, I currently have several domains running through my redbird setup all pointing to various web servers over a selection of machines connected via vlans using a mix of http and https.

I am currently trying to add Plan to the list of websites run through redbird however i get the following error: HPE_UNEXPECTED_CONTENT_LENGTH when loading the page. When looking in the console of redbird is see the following:
image
After talking to the developer of Plan and creating a ticket on their github (link above) it appears to be related to the headers, specifically redbird using: Transfer-encoding: where as plan uses: Content-Length.
Is anyone able to help with either solving the problem or advising how i can tap into the system to manipulate the request / response accordingly. Currently this is the code i am trying to run but as you can see it does not run in the above image:

proxy.register("example.net", "http://192.168.100.2:8804", {
	ssl: {
		key: "certs/example.net-key.pem",
		cert: "certs/example.net-cert.pem",
	},
//},{
	onRequest: (req, res, target) => {
      // called before forwarding is occurred, you can modify req.headers for example
      // return undefined to forward to default target
	  console.log(target)
	  console.log("=================================================")
	  console.log(req)
	  console.log("=================================================")
	  console.log(res)
	  console.log("=================================================")
	  res.removeHeader('transfer-encoding'); // changing the header
    }
});

It seems that the onRequest is never called and I dont seem to be able to find any good documentation on it either which is not helping matters.

Many thanks to anyone who can help. I really would prefer not to have to change my proxy over this.

@jackmaresca
Copy link

Maybe you are using latest version on npm which does not contains commits regarding onRequest, proxyTimeout..

@Starystars67
Copy link
Author

@jackmaresca that is correct, latest from npm. Given your comment can you tell me a github version/tag or commit version to work from if you know of a stable one?

@jackmaresca
Copy link

You can insert github link in package.json and download latest as explained here:
https://stackoverflow.com/questions/17509669/how-to-install-an-npm-package-from-github-directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants