Skip to content
Merged
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
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
DOCS_S3_CONFIG="s3-config.json"
DOCS_CLOUDFRONT_ID="E1MYDYF65FW3HG"
DOCS_LAMBDA_FUNCTION_REDIRECTS="DockerDocsRedirectFunction-labs"
DOCS_SLACK_MSG="Successfully deployed docs-labs from lab branch. $DOCS_URL"
else
echo >&2 "ERROR: unknown branch ${{ github.ref }}"
exit 1
Expand Down
12 changes: 9 additions & 3 deletions _releaser/cloudfront-lambda-redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,24 @@ exports.handler = (event, context, callback) => {
}

const redirectsPrefixes = JSON.parse(`{{.RedirectsPrefixesJSON}}`);
for (let key in redirectsPrefixes) {
if (!request.uri.startsWith(key)) {
for (let x in redirectsPrefixes) {
const rp = redirectsPrefixes[x];
if (!request.uri.startsWith(`/${rp['prefix']}`)) {
continue;
}
let newlocation = "/";
if (rp['strip']) {
let re = new RegExp(`(^/${rp['prefix']})`, 'gi');
newlocation = request.uri.replace(re,'/');
}
//console.log(`redirect: ${request.uri} to ${redirectsPrefixes[key]}`);
const response = {
status: '301',
statusDescription: 'Moved Permanently',
headers: {
location: [{
key: 'Location',
value: redirectsPrefixes[key],
value: newlocation,
}],
},
}
Expand Down
111 changes: 90 additions & 21 deletions _releaser/redirects-prefixes.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,90 @@
{
"/compliance/": "/",
"/datacenter/": "/",
"/ee/": "/",
"/v1.4/": "/",
"/v1.5/": "/",
"/v1.6/": "/",
"/v1.7/": "/",
"/v1.8/": "/",
"/v1.9/": "/",
"/v1.10/": "/",
"/v1.11/": "/",
"/v1.12/": "/",
"/v1.13/": "/",
"/v17.03/": "/",
"/v17.06/": "/",
"/v17.09/": "/",
"/v17.12/": "/",
"/v18.03/": "/",
"/v18.09/": "/"
}
[
{
"prefix": "compliance/",
"strip": false
},
{
"prefix": "datacenter/",
"strip": false
},
{
"prefix": "ee/",
"strip": false
},
{
"prefix": "v1.4/",
"strip": true
},
{
"prefix": "v1.5/",
"strip": true
},
{
"prefix": "v1.6/",
"strip": true
},
{
"prefix": "v1.7/",
"strip": true
},
{
"prefix": "v1.8/",
"strip": true
},
{
"prefix": "v1.9/",
"strip": true
},
{
"prefix": "v1.10/",
"strip": true
},
{
"prefix": "v1.11/",
"strip": true
},
{
"prefix": "v1.12/",
"strip": true
},
{
"prefix": "v1.13/",
"strip": true
},
{
"prefix": "v17.03/",
"strip": true
},
{
"prefix": "v17.06/enterprise/",
"strip": false
},
{
"prefix": "v17.06/",
"strip": true
},
{
"prefix": "v17.09/",
"strip": true
},
{
"prefix": "v17.12/",
"strip": true
},
{
"prefix": "v18.03/ee/",
"strip": false
},
{
"prefix": "v18.03/",
"strip": true
},
{
"prefix": "v18.09/ee/",
"strip": false
},
{
"prefix": "v18.09/",
"strip": true
}
]