Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aws4.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ RequestSigner.prototype.isSingleRegion = function() {
}

RequestSigner.prototype.createHost = function() {
if(this.request.uri) {
this.request.path = url.parse(this.request.uri).path
return url.parse(this.request.uri).host
}
var region = this.isSingleRegion() ? '' :
(this.service === 's3' && this.region !== 'us-east-1' ? '-' : '.') + this.region,
service = this.service === 'ses' ? 'email' : this.service
Expand Down
13 changes: 13 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,16 @@ request(aws4.sign({

//request(aws4.sign({service: 'sdb', path: '/?Action=ListDomains&Version=2009-04-15'}))

// API Gateway with amazonaws domain name
request(aws4.sign({
uri: 'https://xxxxxx.execute-api.us-west-2.amazonaws.com/v1/required-iam-auth',
service: 'execute-api',
region: 'us-west-2'
}))

// API Gateway with custom domain name
request(aws4.sign({
uri: 'https://<custom_domain_name>/required-iam-auth',
service: 'execute-api',
region: 'us-west-2'
}))