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

Tusd behind Caddy Webserver? #444

Closed
leaanthony opened this issue Dec 18, 2020 · 13 comments
Closed

Tusd behind Caddy Webserver? #444

leaanthony opened this issue Dec 18, 2020 · 13 comments
Labels

Comments

@leaanthony
Copy link

Question
In the examples directory, there are configs for Nginx and Apache. I'm wondering if anyone has got it working with Caddy? I kinda had it working but under load I would get tcp timeouts during the response stage (5x 5G files being uploaded concurrently). At lighter loads it was fine. I was using a basic reverse proxy configuration with flush_interval set to -1.

@Acconut
Copy link
Member

Acconut commented Dec 19, 2020

I have never worked with Caddy, but I would assume you can get tusd running with it. tusd does not have many requirements towards proxies. What exactly do you mean with "tcp timeouts"? Are those the error messages in responses from tusd or are those the errors that your tus client is emitting on its own?

@leaanthony
Copy link
Author

leaanthony commented Dec 20, 2020

The errors I am seeing are from tusd:

tusd[1127]: [tusd] 2020/12/16 10:37:32 event="ResponseOutgoing" status="500" method="PATCH" path="<snip>" error="read tcp: i/o timeout" requestId=""

This happens under load when using a reverse proxy. Going direct to the tusd port over http does not hit this issue.

My current reverse proxy config is:

(server) :443 {
    reverse_proxy /files/* http://127.0.0.1:10080 {
        flush_interval -1
        header_up Connection Upgrade
        header_up Upgrade Websocket
    }
}

@leaanthony
Copy link
Author

I'm now wondering if this might be the issue...

@Acconut
Copy link
Member

Acconut commented Dec 21, 2020

Well, it is necessary to setup the proxy as explained in https://github.com/tus/tusd/blob/master/docs/faq.md#can-i-run-tusd-behind-a-reverse-proxy. If that's not the case for your infrastructure, it is very likely to not work. I am also confused what the Upgrade: websocket header has to do in your configuration.

That being said, your timeouts sound more to be caused by https://github.com/tus/tusd/wiki/Thoughts-on-handling-connection-issues. There are plans to improve this and I would like to address them soonish but not ETA is available.

@leaanthony
Copy link
Author

Apart from max body size, I think it's ok? Regarding the websocket, I dunno, I was just following the nginx.conf in the example directory. Is this wrong?
image

@Acconut
Copy link
Member

Acconut commented Jan 3, 2021

flush_interval seems to be disabled response buffering but not request buffer. You should make sure that Caddy does not buffer the request. Maybe Caddy already does that automatically but I do not know.

The Upgrade header in our Nginx configuration is not hard coded to websocket, as your configuration is. Instead, we set it to whatever value the incoming HTTP request uses. So it is not the same behavior. Please fix that in your configuration or remove it all together.

@leaanthony
Copy link
Author

Thanks for the feedback! I'll review the config based on your feedback 👍

@gedw99
Copy link

gedw99 commented Feb 25, 2023

hey @leaanthony Did you have any luck with Caddy.

@punowo
Copy link

punowo commented Jul 2, 2024

@leaanthony Did you manage to get it working ?

@Acconut
Copy link
Member

Acconut commented Jul 3, 2024

@leaanthony What problem are you facing?

@leaanthony
Copy link
Author

I'm not, I just haven't looked at this for more than 3 years

@Acconut
Copy link
Member

Acconut commented Jul 3, 2024

Apologies, I wanted to ask @punowo.

@punowo
Copy link

punowo commented Jul 3, 2024

@Acconut None related to this issue. I was just looking for examples of working Caddy configurations.

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

No branches or pull requests

4 participants