-
Notifications
You must be signed in to change notification settings - Fork 95
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
Https proxy (via CONNECT) support #155
Open
uralm1
wants to merge
20
commits into
jgaa:master
Choose a base branch
from
uralm1:https_proxy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e85a043
Use new docker compose, small cleanups
uralm1 fbf3933
Merge pull request #1 from uralm1/small_fixes
uralm1 bfbe817
Merge branch 'fix_url_colon_parsing' into https_proxy
uralm1 33c9c54
HTTPS CONNECT proxy support. No auth yet.
uralm1 5f34973
Fix connection passing
uralm1 0483409
Implement sending plain data over tls socket before handshake.
uralm1 bdda9e0
Documentation update
uralm1 21217ab
Fix SNI host for tls protocol over proxy
uralm1 3638b8d
Merge branch 'jgaa:master' into https_proxy
uralm1 6efc0e1
Optimize code
uralm1 1e57b61
string_view reverted to string_ref (req for boost 1.58)
uralm1 bad32d4
Merge branch 'https_proxy' of github.com:uralm1/restc-cpp into https_…
uralm1 96008a5
Merge branch 'master' of github.com:jgaa/restc-cpp into https_proxy
uralm1 961f59e
Added simple https proxy test
uralm1 fb22c59
Add more proxy tests and update squid config
uralm1 967f6a2
Fix some proxy usage corner cases
uralm1 099015d
Improve parameter spelling
uralm1 1f250b4
Add proxy detection function proxy.detect()
uralm1 4b56c94
revert deprecated resolver::query back for boost1.58
uralm1 a589a53
Improve cert scripts naming
uralm1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ services: | |
build: nginx | ||
ports: | ||
- "3001:80" | ||
- "3002:443" | ||
links: | ||
- "json:api" | ||
squid: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
openssl req -x509 -newkey rsa:4096 -keyout test-key.pem -out test.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=Test/L=Test/OU=Test/O=Test/CN=localhost" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3000:80"
|
||
|
||
#openssl x509 -in test.pem -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
server { | ||
listen 443 ssl; | ||
server_name localhost; | ||
gzip on; | ||
gzip_proxied any; | ||
ssl_certificate /etc/nginx/ssl/test.pem; | ||
ssl_certificate_key /etc/nginx/ssl/test-key.pem; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
|
||
|
||
location ~ ^/cookies(/?)(.*)$ { | ||
add_header Content-Type "application/json; charset=utf-8"; | ||
add_header Set-Cookie test1=yes; | ||
add_header Set-Cookie test2=maybe; | ||
add_header Set-Cookie test3=no; | ||
return 200 '{}'; | ||
} | ||
|
||
location ~ ^/normal(/?)(.*)$ { | ||
proxy_pass http://json/$2$is_args$args; | ||
} | ||
|
||
location ~ ^/close(/?)(.*)$ { | ||
proxy_pass http://json/$2$is_args$args; | ||
keepalive_timeout 0; | ||
} | ||
|
||
# Force nginx to resolve 'json' | ||
location /dns_workaround { | ||
proxy_pass http://json; | ||
} | ||
|
||
location ~ ^/loop(/?)(.*)$ { | ||
return 301 $scheme://$host:3001/loop/$2$is_args$args; | ||
} | ||
|
||
location ~ ^/redirect(/?)(.*)$ { | ||
return 301 $scheme://$host:3001/normal/$2$is_args$args; | ||
} | ||
|
||
location ~ ^/reredirect(/?)(.*)$ { | ||
return 301 $scheme://$host:3001/redirect/$2$is_args$args; | ||
} | ||
|
||
location ~ ^/restricted(/?)(.*)$ { | ||
auth_basic "Restricted Area"; | ||
auth_basic_user_file /etc/nginx/htpasswd; | ||
proxy_pass http://json/$2$is_args$args; | ||
} | ||
|
||
location ~ ^/upload_raw(/?)(.*)$ { | ||
limit_except POST { deny all; } | ||
return 200 "OK"; | ||
} | ||
|
||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDPlSJHl/g59nyi | ||
HvVblS5eWCTRxFFueCIEbYGfUdeL+Jc+YP20fJs3u5Tq7gCvuYqGTMztXfERRk3H | ||
NrHy1uXndh0fGVUusn5hYz4XNB8AmRfZf1wDTpd4SjVe26Da52sIGppj1bGgPJWR | ||
9KK+7zDPNeEVQ4HPYnh8rTfHBG0vYlfHnHR4EGwS6znKA3YIgwHqHIrdm/cOmMK3 | ||
hDMmjG8l01U5YHIBOadTh1QZvqhpEToJXnV949CvN12HiyawSQ3nG3HTC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J3MGRcCXmOYxRPIKGULsGUtzhiYLN5k8bUg4st4fSGP4xwBCTD | ||
ND6XY8cr/ycSgWrhhePc4Uj7gZ6WdYH2JbpHgp4DVto3LhO1X7HUo+9xoM8vZbUR | ||
qng7DDgZj7YfPGCYFuTA0GNCJhWx+k+QTwOyPbFRAoIBAGzhHBrLEhWDcjF6IfHR | ||
xHBIhxJRFEWKLR7KeqebFI+ySzIdi8utcRbVFrMP+5WZEDu7M2qcNri0V9TJVZBm | ||
n3EwA6c768uE3TDvb0Oy9i5VLtRHDjDfuTE3g55kYsSVIJ/gXii1B2u4vDnBhqE1 | ||
/S6NqMJyJI7SzlZTzRuQ7EZCDQhG+BzEsnqc/o1xUT47tAAKiho1MVEQz6N8j6SH | ||
7K5xTTbxPHqS7Bab+cK4DHjr7rGvjQtur3xDCfgX22p3NasPf6egbigZGsJZp0yr | ||
uG/94bRKpm+iWFeVE9XyqFFsCMMT4TkN7F/KxlhFe4KB0rJRzaPBjHETJWz1jTIT | ||
P48CggEBAL0X4oyLJvdYFh41yBOSMmOg7ulUyqEZRgKrHQQ75/qb6lxa4FcGymiH | ||
iNXsU4/o3PwJcUg0zEilkllYyVDKOXtjHEMipONifPgI2eaEPLdA97QmGVFRNFTk | ||
gWXMxMVRL6+TSPSnOU/PuOPbRTMIDMFdnZj2VeDf0M4uHwPRPwBGPYa8jW9m+Vz2 | ||
senoxaJnwakywphSQWbr2HcS0PzJhGhyKBcbX2SYK0esPjLILvTkbyzYfgT3SJnH | ||
Ybu1KPcUH7sZKqn7KLDLzCSNq1pDM4asj8i3gGCjRAA3mPyDHrZ83L1LYVUE+gMh | ||
stBsKJU1QibpCwO3/NmBYwjRitw1E2c= | ||
-----END PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-----BEGIN CERTIFIC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qgdUStKDzpDB48eOvvbRRAZO55KA | ||
YzCS/1dgfFUcsugP7DklblI3kTNHTIjarYYXJjUNl0Tpcx3Tk6hfgBBMX1Re/Gtv | ||
TwIDAQABo1MwUTAdBgNVHQ4EFgQUtH5zl0rC27e1JxtdMbIxwqkg0NQwHwYDVR0j | ||
BBgwFoAUtH5zl0rC27e1JxtdMbIxwqkg0NQwDwYDVR0TAQH/BAUwAwEB/zANBgkq | ||
hkiG9w0BAQsFAAOCAgEAw7sQ1KIyHCYHJUzYdX9I/l0ylbzrKpfJUABq3OOmgjUM | ||
k6InH6bXvAEP7bj4zC3UDKj1hf5WVHQM0yUeLx8ZmzHzsgfS6C8MiSt+47V0NboQ | ||
5aGHY21ceMivlNDihf0cjPg+h4NsAZkzMWR771Nxe3WLT20Wo1ehKqCjIC7HnCJ3 | ||
IAKbholWJwaiu1Y9tLn21sNMC0Z75hx/JWokP8OuZUyLxsp5RDLLvPA4N41z1Tep | ||
CXpBct6jdRVzq7b5bUgPIQJ4XVdnaIYtdWIZVavulbr0vo4P7dayhf7ZWGcFVyPh | ||
GmjHsPiurZy5BShEOgyYlwrSf9guDJfLR0gclKysKF1I4O9EWysRntvxuDMg0bys | ||
jdUkp25EjQzIP/gA5J6NhTUFYnt04cLIebxs8CU/ZqZ0QZ11wT3VnvTm9ukTsaT4 | ||
lKzmBjlejZVLwlki6r3IAj/CD2v9pJddt950usj9/I9C6quw1XpWG6TYZlCyM9lb | ||
ucUfPttVknOM8c/eenXYAECR/f9MqlFBHO3Bj9YfO4hGTZtE7qaiY2f6yhcLRCOt | ||
Bd649G/bfKT0KvLp+6SdTJxMYFC70FUqoqniEfxT+AhsKP+2k0MfU4MvJ/neLcGA | ||
l/fM+TeIJWTzadl/DCZeE0FyQXAzeqHICnNQOieH6spMpjiXd6cv0aPO1zSqpV4= | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
|
||
reply_header_add Test-proxy "THIS IS TEST PROXY" all | ||
acl CONNECT method CONNECT | ||
acl connect_denied_ports port 444 | ||
http_access allow localhost manager | ||
http_access deny manager | ||
http_access deny CONNECT connect_denied_ports | ||
http_access allow all | ||
http_port 3128 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3000:80"
nginx:
build: nginx
ports:
- "3001:80"
- "3002:443"
links:
- "json:api"
squid:
build: squid
ports:
- "3003:3128"
links:
- "nginx:api.example.com"