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

Rclone compatibility not working cause of header ignored #141

Closed
drappier-charles opened this issue Jan 13, 2022 · 2 comments
Closed

Rclone compatibility not working cause of header ignored #141

drappier-charles opened this issue Jan 13, 2022 · 2 comments

Comments

@drappier-charles
Copy link

Usecase :
I have an rclone client and I try to do that command :
$ rclone copy myinstance:mybucket:test.csv test.csv

It generate a signature from an access_key / access_secret_key couple
That signature use a range header cause my file is a file of 500meg

In a middleware I use aws4 library to compute the signature with all the needed data (same couple of key + request information send by rclone)

The signature is not the same, cause aws4 library remove the range header
I've found it's hardcoded to ignore it (at signature time)

const HEADERS_TO_IGNORE = {
  authorization: true,
  connection: true,
  'x-amzn-trace-id': true,
  'user-agent': true,
  expect: true,
  'presigned-expires': true,
  range: true
}

I've fork the library to set range to false, it appear to not be overridable with a configuration
My question here is, why do you ignore that header? Is there a reason? (other bug?)
I understand that's it's a combination of multiple library
https://github.com/mhart/aws4fetch/blob/b3aed16b6f17384cf36ea33bcba3c1e9f3bdfefd/src/main.js#L25-L34
Apparently in aws4fetch they ignore it, but as they don't have same usecase I'm not sure it's a good reference.

Thanks by advance, I think best way to go with it, could be to have it in option, keeping your current standard configuration

@drappier-charles
Copy link
Author

Look like they got the same issue at the end
mhart/aws4fetch#39

@mhart
Copy link
Owner

mhart commented Jan 8, 2023

You can now do this using extraHeadersToInclude:

aws4.sign({
  service: 'mycustomservice',
  path: '/whatever',
  headers: {
    'Range': 'bytes=200-1000, 2000-6576, 19000-'
  },
  extraHeadersToInclude: {
    'range': true
  }
})

@mhart mhart closed this as completed Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants