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

feat: add proxy config #220

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

feat: add proxy config #220

wants to merge 2 commits into from

Conversation

yokishava
Copy link
Contributor

@yokishava yokishava commented Jan 14, 2024

Why

A proxy may be present when sending outbound requests. However, this PR was created because requests are not currently sent through a proxy.

What

  • added the environment variable NODEX_PROXY_ENDPOINT
  • defined ProxyConfig
  • added the use of ProxyConfig in HubClient and HttpClient.
    • added function "build_client" in HubClient and HttpClient to generate Client using the value of proxy.

Check

I built a proxy (nginx) in my local environment and verified that I can send requests via proxy.
The following are the logs recorded by the proxy.
(I have temporarily set NodeX to the user_agent of reqwest to make the logs easier to read.)

$ tail logs/access.log

127.0.0.1 - - [14/Jan/2024:19:23:19 +0900] "POST http://localhost:8000/v1/device HTTP/1.1" 200 2 "-" "NodeX" "-"
127.0.0.1 - - [14/Jan/2024:19:23:22 +0900] "POST http://localhost:8000/v1/device-info HTTP/1.1" 200 2 "-" "NodeX" "-"
127.0.0.1 - - [14/Jan/2024:19:23:23 +0900] "POST http://localhost:8000/v1/heartbeat HTTP/1.1" 200 2 "-" "NodeX" "-"
127.0.0.1 - - [14/Jan/2024:19:23:24 +0900] "POST http://localhost:8000/v1/message/list HTTP/1.1" 200 4064 "-" "NodeX " "-"
127.0.0.1 - - [14/Jan/2024:19:23:28 +0900] "POST http://localhost:8000/v1/message/list HTTP/1.1" 200 4064 "-" "NodeX " "-"
127.0.0.1 - - [14/Jan/2024:19:23:33 +0900] "POST http://localhost:8000/v1/message/list HTTP/1.1" 200 4064 "-" "NodeX " "-"
127.0.0.1 - - [14/Jan/2024:19:23:39 +0900] "POST http://localhost:8000/v1/message/list HTTP/1.1" 200 4064 "-" "NodeX " "-"
127.0.0.1 - - [14/Jan/2024:19:23:43 +0900] "POST http://localhost:8000/v1/message/list HTTP/1.1" 200 4064 "-" "NodeX " "-"

@yokishava yokishava self-assigned this Jan 14, 2024
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 this pull request may close these issues.

None yet

1 participant