Created
January 2, 2018 08:48
-
-
Save tsertkov/af99420d26dba62d275e0616f4358971 to your computer and use it in GitHub Desktop.
Generate AWS S3 redirecting routing rules
This file contains 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
console.log('<RoutingRules>') | |
;[ | |
['/url1/', '/url2/'], | |
['/url11/', '/url22/'] | |
].forEach(([source, target]) => console.log(` | |
<RoutingRule> | |
<Condition> | |
<KeyPrefixEquals>${source}</KeyPrefixEquals> | |
</Condition> | |
<Redirect> | |
<ReplaceKeyWith>${target}</ReplaceKeyWith> | |
</Redirect> | |
</RoutingRule> | |
`)) | |
console.log('</RoutingRules>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment