-
Notifications
You must be signed in to change notification settings - Fork 132
--custom-header
option doesn't work with only one header
#368
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
--custom-header
option doesn't work
Thanks for this investigation @Timost. Can you also clarify what version of node is used btw? Adding
|
it("custom-header", function (done) { | |
var args = [ | |
"--ip", | |
"127.0.0.1", | |
"--ssl-cert", | |
"test/server.crt", | |
"--ssl-key", | |
"test/server.key", | |
"--port", | |
port, | |
"--default-target", | |
testUrl, | |
"--custom-header", | |
"k1: v1", | |
"--custom-header", | |
" k2 : v2 v2 ", | |
]; | |
executeCLI(execCmd, args).then((cliProcess) => { | |
childProcess = cliProcess; | |
r(SSLproxyUrl).then((body) => { | |
body = JSON.parse(body); | |
expect(body.headers).toEqual( | |
jasmine.objectContaining({ | |
k1: "v1", | |
k2: "v2 v2", | |
}) | |
); | |
done(); | |
}); | |
}); | |
}); |
Hmm... --custom-header
should be headers are to be added to the proxied HTTP request, not the proxied response - is it perhaps so that we add them to the proxied response rather than the proxied request? I think the test confirms that headers are added at one point, but to what?
Related
@minrk do you have an idea why our test succeeded? |
No problem ! Thank you for the quick answer 💪
Sure it's node 16 from this docker image lts-bullseye
Yeah I read #242, and I was also surprised about that. I didn't spend time to dig into the issue though. 😅 Regarding the PR, is there some specific things about the dev setup/environement I should be aware of ? |
Hmmm, I'm not sure, I've not developed code for this repo much. The CI/CD system can make a test for you without needing to set things up yourself, but if you do, I imagine you should use |
Fixed by #369 The test passing is super weird, but reveals a workaround while you wait for a release: add a second |
Wow thank you for looking into this and for #369. |
--custom-header
option doesn't work--custom-header
option doesn't work with only one header
Hi ! Thank you for jupyterhub 🙏 ❤️ !
I've been stumbling on a bug with this proxy. Probably introduced with #223
Bug description
The
--custom-header
flag doesn't work in version v4.5.0.Running
Doesn't add the
testcustomheader:mytestcustomheader
header to proxified requests.Expected behaviour
The headers contain the custom header set with the command-line option.
Actual behaviour
The headers don't contain the additional header. More over the parsed args are wrong:
notice the undefined for the
customHeader
option.How to reproduce
I've stumbled on this bug while using jupyterhub, so the setup is quite intricate and I don't have an easily reproducible setup at hand.
I can work on it though if needed.
Your personal set up
I'm using
configurable-http-proxy
with jupyterhub with a non configurable reverse-proxy in front. So I can't setup theX-Forwarded
as recommended by the docs. So I was trying to enforce them directly inconfigurable-http-proxy
using the--custom-header
flag.OS: docker debian bullseye
Version(s): jupyterhub 2.0.2
Configuration
Proposed fix
After some fidling, it appears the collectHeadersIntoObject is missing a return statement (and also calls an undefined log function in case of error).
Adding it fixes the issue.
I'm willing to submit a PR if you are accepting them.
The text was updated successfully, but these errors were encountered: