Skip to content
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

iroh-relay does not work behind nginx proxy #445

Closed
link2xt opened this issue Oct 30, 2024 · 3 comments · Fixed by #451
Closed

iroh-relay does not work behind nginx proxy #445

link2xt opened this issue Oct 30, 2024 · 3 comments · Fixed by #451
Assignees
Labels
bug Something isn't working

Comments

@link2xt
Copy link
Contributor

link2xt commented Oct 30, 2024

Merged #434 does not actually work with CI. Current Rust CI fails with:

2024-10-30T17:35:07.513075Z ERROR iroh_net::relay::client: expected status 101 SWITCHING_PROTOCOLS, got: 400 Bad Request
2024-10-30T17:35:07.727201Z ERROR iroh_net::relay::client: expected status 101 SWITCHING_PROTOCOLS, got: 400 Bad Request
2024-10-30T17:35:07.860342Z ERROR iroh_net::relay::client: expected status 101 SWITCHING_PROTOCOLS, got: 400 Bad Request
2024-10-30T17:35:08.072525Z ERROR iroh_net::relay::client: expected status 101 SWITCHING_PROTOCOLS, got: 400 Bad Request
2024-10-30T17:35:08.209491Z ERROR iroh_net::relay::client: expected status 101 SWITCHING_PROTOCOLS, got: 400 Bad Request
2024-10-30T17:35:08.420977Z ERROR iroh_net::relay::client: expected status 101 SWITCHING_PROTOCOLS, got: 400 Bad Request

Probably something like websocket support is missing.

@link2xt link2xt added the bug Something isn't working label Oct 30, 2024
@link2xt
Copy link
Contributor Author

link2xt commented Oct 30, 2024

iroh relay uses Upgrade header with values "iroh derp http" and "websocket". At least "Upgrade" header should be passed through.

@link2xt
Copy link
Contributor Author

link2xt commented Oct 30, 2024

I added Environment="RUST_LOG=debug" to /etc/systemd/system/iroh-relay.service to make it log all HTTP requests. Looks like nginx does not pass the requests through and responds with 400 Bad Request.

With some debug logging from nginx, looks like it is unhappy with "Upgrade: iroh derp http" header:

Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http process request line
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http request line: "GET /relay HTTP/1.1"
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http uri: "/relay"
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http args: ""
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http exten: ""
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 posix_memalign: 000055BC6A4E5F90:4096 @16
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http process request header line
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http header: "upgrade: iroh derp http"
Oct 30 23:47:36 c2-new nginx[1316977]: 2024/10/30 23:47:36 [debug] 1316977#1316977: *162 http header done
Oct 30 23:47:36 c2-new nginx[1316977]: c2-new nginx: 127.0.0.1 - - [30/Oct/2024:23:47:36 +0000] "GET /relay HTTP/1.1" 400 150 "-" "-"

@link2xt
Copy link
Contributor Author

link2xt commented Oct 31, 2024

Enabled some more debug logging in nginx:

Oct 30 23:55:42 c2-new nginx[1317239]: 2024/10/30 23:55:42 [info] 1317239#1317239: *210 client sent HTTP/1.1 request without "Host" header while reading client request headers, client: 127.0.0.1, server: _, request: "GET /relay HTTP/1.1"
Oct 30 23:55:42 c2-new nginx[1317239]: c2-new nginx: 127.0.0.1 - - [30/Oct/2024:23:55:42 +0000] "GET /relay HTTP/1.1" 400 150 "-" "-"

Seems iroh client does not send the Host header.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant