File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -405,10 +405,12 @@ function redirectToS3(r) {
405
405
var isDirectoryListing = allow_listing && _isDirectory ( uriPath ) ;
406
406
407
407
if ( isDirectoryListing && r . method === 'GET' ) {
408
+ _debug_log ( r , 'Redirecting to S3Listing..' )
408
409
r . internalRedirect ( "@s3Listing" ) ;
409
410
} else if ( ! isDirectoryListing && uriPath === '/' ) {
410
411
r . internalRedirect ( "@error404" ) ;
411
412
} else {
413
+ _debug_log ( r , 'Redirecting to S3..' )
412
414
r . internalRedirect ( "@s3" ) ;
413
415
}
414
416
}
@@ -1013,11 +1015,12 @@ async function _fetchEC2RoleCredentials() {
1013
1015
async function _fetchWebIdentityCredentials ( r ) {
1014
1016
var arn = process . env [ 'AWS_ROLE_ARN' ] ;
1015
1017
var name = process . env [ 'HOSTNAME' ] || 'nginx-s3-gateway' ;
1018
+ var sts_endpoint = process . env [ 'STS_ENDPOINT' ] || 'https://sts.amazonaws.com' ;
1016
1019
var token = fs . readFileSync ( process . env [ 'AWS_WEB_IDENTITY_TOKEN_FILE' ] ) ;
1017
1020
1018
1021
var params = "Version=2011-06-15&Action=AssumeRoleWithWebIdentity&RoleArn=" + arn + "&RoleSessionName=" + name + "&WebIdentityToken=" + token ;
1019
1022
1020
- var response = await ngx . fetch ( "https://sts.us-east-1.amazonaws.com ?" + params , {
1023
+ var response = await ngx . fetch ( sts_endpoint + " ?" + params , {
1021
1024
headers : {
1022
1025
"Accept" : "application/json"
1023
1026
} ,
You can’t perform that action at this time.
0 commit comments