-
Notifications
You must be signed in to change notification settings - Fork 496
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
how to set/overwrite cors in the tusd code provided in the doc #450
Comments
I am sorry to hear that you are struggling so much with tusd. However, there is currently no way to change or overwrite the CORS setup from tusd. Neither programmatically nor using the tusd binary. The only option right now it to use an external proxy, such as nginx. Since this is an often requested feature, we are always open for PRs to improve in this regard :) |
@Acconut if only this was written in the doc, you would save me tons of time and struggles I was able to set CORS via Nginx but the upload is not resumable even though I added:
here is a live demo: ********* (demo link deleted) I use uppy with resume: true, when I pause and I resume, it starts again from the very beginning. |
Could it be that there is another proxy between the browser and your nginx before tusd? Maybe from your hosting provider? It looks like this proxy buffers the request from a brief look. |
@Acconut yeah you are right, it seems that the url they provided me with was using some kind of proxy/load-balancer, once I added an IPv4 it started working finally :) I'm ready now to upload files, but most importantly I will be sure to write a blog post about all the challenges I faced during the implementation, hopefully, I can save people like me some time... just one last piece, as I'm using tusd programmatically, any method I can verify the upload is authorized? |
You can use the PreCreateCallback in the config struct: https://godoc.org/github.com/tus/tusd/pkg/handler#Config
Feel free to send us the link as well, so we can try to improve in these areas :) |
@Acconut yeah I see the PreUploadCreateCallback... as I'm totally new to GO I have to take a little time to figure out how to use it with the necessary verifications. I will make sure to send the URL once I get it done. Thank you very much for the guidance, you just saved me an extra 3 days (lol) 👍 |
Could you please consider adding a tusd flag to enable Following this issue we enabled
Without cookies tus requests are distributed randomly to our tusd instances, which caused the corruption mentioned here. We're not running, nor planning to run another reverse-proxy between the loadbalancer and tusd instance, adding nginx just to add this header feels like trying to kill a fly with a bazooka, especially given that this exact use-case seems to be recommended thorough the tus projects :) I'm not a gopher, but adding a flag and conditionally adding the allow-credentials header here doesn't sound that hard? Would that be something you'd consider merging if I prepared a PR? Thanks! |
That's a good reason, I never came across before. I am open to adding options for customizing the CORS header sent by tusd since this is a popular issue. So feel free to open a PR. However, it would be helpful if we have a concept for not only customizing |
@Acconut noted, I'll consider. This seems like a bigger issue though. In meanwhile I got to the same issue with cookies in our react-native app, which goes deep through react-native-tus-client, tus-android-client down to this tus-java-client PR here, pointing that cookies are not passed and the related discussion about changing http stack/client. |
Oh right, thanks for letting us know that the Java client does not support Cookies. As I said, people are apparently rarely using Cookies with tusd, so this is a bit of untested territory. |
This is implemented in #997 and will be included in the next release. |
Question
I'm not a GO developer (I even did my best to learn GO basics just in the hope to make it works) but after wasting days without luck, I will do my last try to find an answer, otherwise, I'm giving up all the GO story because it just hurts to burn all the energy without finding the simplest answer: can just someone tell how to set cors to a specific host (i.e: example.com) instead of the default * without using a proxy
Setup details
Here is the example from the doc (we just need a way to overwrite the "Access-Control-Allow-Origin", I browsed the whole internet and can't find someone answering it !!!
The text was updated successfully, but these errors were encountered: