Skip to content

Commit 1015d1b

Browse files
authored
S3 Redirection Rules supports JSON (#18)
Replace XML with JSON
1 parent 7544909 commit 1015d1b

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,20 @@ or
109109
* * Go to **Properties (next to Permissions) -> Static website hosting -> Select "Use this bucket to host a website"**
110110
* * In **Index document** paste any file, it'd be logical to name it _"index.html"_
111111
* * Paste this **Redirection rules**
112-
```xml
113-
<RoutingRules>
114-
<RoutingRule>
115-
<Condition>
116-
<KeyPrefixEquals/>
117-
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
118-
</Condition>
119-
<Redirect>
120-
<Protocol>https</Protocol>
121-
<HostName>__DOMAIN__</HostName>
122-
<ReplaceKeyPrefixWith>__PATH_TO_LAMBDA__?path=</ReplaceKeyPrefixWith>
123-
<HttpRedirectCode>307</HttpRedirectCode>
124-
</Redirect>
125-
</RoutingRule>
126-
</RoutingRules>
112+
```json
113+
[
114+
{
115+
"Condition": {
116+
"HttpErrorCodeReturnedEquals": "404"
117+
},
118+
"Redirect": {
119+
"Protocol": "https",
120+
"HostName": "__DOMAIN__",
121+
"ReplaceKeyPrefixWith": "__PATH_TO_LAMBDA__?path=",
122+
"HttpRedirectCode": "307"
123+
}
124+
}
125+
]
127126
```
128127
> Pay attention to `__DOMAIN__` and `__PATH_TO_LAMBDA__` (protocol is always _https_)
129128
> This is your **API endpoint**. For example, if the url is `https://some-id.execute-api.us-east-1.amazonaws.com/your-stage/your-lambdas-name`, the correct xml nodes shall look like

0 commit comments

Comments
 (0)