tusd icon indicating copy to clipboard operation
tusd copied to clipboard

Tusd behind Haproxy: Upload in Chrome fails with CORS while Firefox works fine.

Open xn-zhao opened this issue 3 years ago • 1 comments

Describe the bug

We build a tus server behind haproxy [that listen https on :443 port] and forward to the tus server In Firefox 96,97 we can use tus-js-client to upload to tus server normally The first request (https) to tus-server, it send back the location with http location Firefox add "s" to http to request to tus-server again for chunk upload: https://.../uuid (https://xxx/api/tus/454a92559b5c0a52b58f308fde6ba151) In Chrome we can not use tus-js-client to upload

The first request (https) to tus-server, it send back the location with http location Chrome keep to http location and send request to tus-server again for chunk upload: http://.../uuid (http://xxx/api/tus/454a92559b5c0a52b58f308fde6ba151) -> it fails here. Because on server it listen on :443 port only. we can use Chrome to upload to tusd.tusdemo.net/

Runtime environment: Browser

Used tus server software: tusd (tusd "github.com/tus/tusd/pkg/handler")

Config in our haproxy:

frontend www-http bind *:81 default_backend backendnodes

frontend haproxynode bind *:443 ssl crt /etc/haproxy/certs/cert.pem http-request set-header X-SSL %[ssl_fc]

default_backend backendnodes

backend backendnodes balance roundrobin redirect scheme https code 301 if !{ ssl_fc } server node2 xx.xx.xx.xx.xx:3001 check

Pls help or give any hint. Thank you.

xn-zhao avatar Mar 10 '22 03:03 xn-zhao

It sounds like you do not have configured your proxy and tusd correctly for usage behind a proxy. This is not a bug. Please read and follow https://github.com/tus/tusd/blob/master/docs/faq.md#can-i-run-tusd-behind-a-reverse-proxy.

Acconut avatar Mar 17 '22 16:03 Acconut