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

question: Is X-Forwarded-Proto set correctly? #92

Open
joncfoo opened this issue Jul 26, 2018 · 2 comments · May be fixed by #119
Open

question: Is X-Forwarded-Proto set correctly? #92

joncfoo opened this issue Jul 26, 2018 · 2 comments · May be fixed by #119

Comments

@joncfoo
Copy link

joncfoo commented Jul 26, 2018

I'm invoking devd with the command below and accessing my application over https://devd.io/. I noticed in my application that X-Forwarded-Proto = http - shouldn't it be https since I am forwarding /=https://127.0.0.1:3000/ ?

devd --port=443 \
	--cert=_certs/devd.io/bundle.pem \
	/=https://127.0.0.1:3000

Changing the following line in reverseproxy.go to req.Header.Set("X-Forwarded-Proto", target.Scheme) results in X-Forwarded-Proto being set to https (it works for my use-case but I'm not sure if this is the right fix?).

req.Header.Set("X-Forwarded-Proto", req.URL.Scheme)

@wader
Copy link
Contributor

wader commented Aug 3, 2018

Hi, this sounds like what was fix in #83 ?

@lancerushing
Copy link

I tracked down a bug with X-Forwarded-Proto.

When using "--cert" X-Forwarded-Proto gets set to "http" (should be "https")

Steps to reproduce:

  1. start web server to show X-Forwarded-Proto header
  2. start devd with --cert="SomeCustomCert"
  3. make request to devd
# start web server in one terminal (netcat will do in a pinch)
nc -l 9000
# start devd in another terminal 
# just use ~/.devd.cert which should be there if you have ever started devd with --tls
devd --cert=${HOME}/.devd.cert http://localhost:9000
# Make request
curl -k https://devd.io:8000

Then inspect the output from netcat. ( ctrl+C to quit netcat)

Note: the "--tls" flag sets X-Forwarded-Proto correctly.

@leg100 leg100 linked a pull request Jul 13, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants