It looks like that url isn’t browsable and has some permission locking on it. Your browser can access it because you are logged in to aws, but your Discourse instance cannot access it because it has not been authorized.
When using curl -O <url> It kept giving errors: Warning: Failed to create the file
But I can get curl -0 <url> -o filename.pdf to work.
Can discourse use other curl command lines? Or can I somehow get it to perform the same download as curl -0 <url> -o filename
I’m unable to get curl -0 <url> -o filename.pdf to work. Can you verify that the filename.pdf is the actual pdf document and not just some xml error.
Also -0 just changes it to “Use HTTP 1.0 (H)” where as -O saves it as a file instead of trying to render the pdf in the console.
The Discourse app doesn’t actually use curl to download the file, but it is just a good way to test anonymous downloads of files and when the discourse app uses ruby to download the file it does do something similar to curl.
In order to determine what the issue is here can you provide some more info on how your s3 bucket file permissions are setup? How do you generate all the extra url parameters to allow “anonymous” access to a private file?
Another option might be to use curl or whatever your using to access the discourse api to download the file or use the aws-sdk to download the file as an authenticated user and then upload the actual file to the discourse api instead of just a url.
Also once you get this all working you might want to turn on this setting in Discourse “prevent anons from downloading files”.