File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
import crypto from 'crypto'
2
2
import { ERRORS } from '@internal/errors'
3
- import { V4StreamingAlgorithm } from '@storage/protocols/s3/signature-v4-stream'
4
3
5
4
interface SignatureV4Options {
6
5
enforceRegion : boolean
@@ -440,6 +439,15 @@ export class SignatureV4 {
440
439
return `${ header } :${ headerValue } `
441
440
}
442
441
442
+ // cloudflare modifies accept-encoding header which causes signing to fail
443
+ // instead use x-original-accept-encoding if available
444
+ if ( header === 'accept-encoding' ) {
445
+ const originalEncoding = this . getHeader ( request , 'x-original-accept-encoding' )
446
+ if ( originalEncoding ) {
447
+ return `${ header } :${ originalEncoding } `
448
+ }
449
+ }
450
+
443
451
return `${ header } :${ this . getHeader ( request , header ) } `
444
452
} )
445
453
. join ( '\n' ) + '\n'
You can’t perform that action at this time.
0 commit comments