Last active
October 14, 2019 15:23
-
-
Save jebai0521/7088ec15dd52a1faddca58679fd09a0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const querystring = require('querystring'); | |
exports.handler = (event, context, callback) => { | |
const request = event.Records[0].cf.request; | |
// request.uri = "/zh-cn" + request.uri; | |
const s3DomainName = 'static-jebai.s3.amazonaws.com' | |
// before : static-jebai.s3.amazonaws.com/index.html | |
// after : static-jebai.s3.amazonaws.com/zh-cn/index.html | |
request.origin = { | |
s3 : { | |
domainName : s3DomainName, | |
region: '', | |
authMethod: 'none', | |
path : "/zh-cn", | |
customHeaders: {} | |
} | |
} | |
request.headers['host'] = [{key: 'host', value : s3DomainName}]; | |
console.log(request); | |
callback(null, request); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment