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

Accept http/2 only deny http/1.1 #1094

Closed
yanyan33333 opened this issue Dec 24, 2017 · 5 comments · Fixed by #1102
Closed

Accept http/2 only deny http/1.1 #1094

yanyan33333 opened this issue Dec 24, 2017 · 5 comments · Fixed by #1102

Comments

@yanyan33333
Copy link

yanyan33333 commented Dec 24, 2017

hello,I use nghttpx + squid in proxy mode , it works fine . but I want nghttpx accept http/2 connections, deny the http/1.1
I found --npn-list in the doc shows that

--npn-list=
Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable protocol comes first. This is used in both ALPN and NPN. The parameter must be delimited by a single comma only and any white spaces are treated as a part of protocol string.

Default: h2,h2-16,h2-14,http/1.1

I wonder that if I use setting like --npn-list=h2 all the connections from http/1.1 has been denied??
Can I disable ALPN or NPN?

@tatsuhiro-t
Copy link
Member

If --npn-list=h2 is used, nghttpx only accepts h2 when TLS is enabled on frontend.

@yanyan33333
Copy link
Author

thanks , but in my test with curl I found that when I visit http url without TLS GET method has been used instead of CONNECT method , which return success

curl -x "https://myproxy" -U "usename:pw" "http://edition.cnn.com/" -v

when I visit https url it goes Proxy CONNECT aborted which means http/1.1 CONNECT method has been denied

curl -x "https://myproxy" -U "usename:pw" "https://google.com/" -v

Is that right?

@yanyan33333
Copy link
Author

and I just try https proxy using CONNECT method with http/1.1 it runs well, return code 200
log shows that

"CONNECT ig-l-b-a.akamaihd.net:443 HTTP/1.1" 200

my setting is

frontend=0.0.0.0,443;tls
backend=127.0.0.1,1234
private-key-file=/xxx.pem
certificate-file=/x.pem
http2-proxy=yes
workers=2
verify-client=no
npn-list=h2
add-x-forwarded-for=no
no-via=yes
no-ocsp=yes
no-host-rewrite=yes
tls-proto-list=TLSv1.2
ciphers=ECDHE+AES128

@tatsuhiro-t
Copy link
Member

It looks like there is a path that --npn-list is ignored. That is when client does not send any NPN/ALPN at all. Will fix it.

@tatsuhiro-t tatsuhiro-t added this to the v1.30.0 milestone Dec 31, 2017
@yanyan33333
Copy link
Author

thanks~~

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

Successfully merging a pull request may close this issue.

2 participants