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 11import crypto from 'crypto'
22import { ERRORS } from '@internal/errors'
3- import { V4StreamingAlgorithm } from '@storage/protocols/s3/signature-v4-stream'
43
54interface SignatureV4Options {
65 enforceRegion : boolean
@@ -440,6 +439,15 @@ export class SignatureV4 {
440439 return `${ header } :${ headerValue } `
441440 }
442441
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+
443451 return `${ header } :${ this . getHeader ( request , header ) } `
444452 } )
445453 . join ( '\n' ) + '\n'
You can’t perform that action at this time.
0 commit comments