TkTech / ckanext-cloudstorage

Implements support for resource storage against multiple popular providers via apache-libcloud (S3, Azure Storage, etc...)
MIT License
35 stars 55 forks source link

Pop Authorization header before redirecting #13

Closed amercader closed 6 years ago

amercader commented 7 years ago

See ckan/datapusher#116 for previous discussion.

Basically what is happening is that the DataPusher is sending a request to download the file that includes the CKAN Authorization header (so we can handle authorization at the CKAN level). But then this same header is forwarded to AWS, which doesn't like it:

<?xml version="1.0" encoding="UTF-8"?> 
<Error>
    <Code>InvalidArgument</Code>
     <Message>Authorization header is invalid -- one and only one ' ' (space) required</Message>
     <ArgumentName>Authorization</Argum...

I think that the Authorization header should be stripped before doing the redirect here but I'm not familiar with the inner workings of the extension @TkTech.

This might be also the cause of #7.

TkTech commented 7 years ago

Any ideas for doing CI tests for these things without having an active AWS account?

rhunwicks commented 7 years ago

@TkTech I don't think this can be fixed in CloudStorage because you are only returning the Redirect to the new location. It is Datapusher that is adding the Authorization header and then leaving it in when it follows the redirect.

See my comment at https://github.com/ckan/datapusher/issues/116#issuecomment-336464225

rhunwicks commented 7 years ago

Also, the trunk version of datapusher no longer has the problem.