hotfix: added flux latest redirect support to edge.js
parent
520f57259e
commit
9525ed3574
|
@ -103,14 +103,14 @@ exports.handler = (event, context, callback) => {
|
|||
/////////////////////////////// Flux redirects ///////////////////////////////
|
||||
// Redirect flux guides and introduction based on latest InfluxDB version
|
||||
if (/v2/.test(latestVersions['influxdb'])) {
|
||||
temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/guides\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/guides\//, `/influxdb/${latestVersions['influxdb']}/query-data/flux/`));
|
||||
temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/introduction\//, `/influxdb/${latestVersions['influxdb']}/query-data/get-started/`));
|
||||
temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//, `/influxdb/${latestVersions['influxdb']}/query-data/flux/`));
|
||||
temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//, `/influxdb/${latestVersions['influxdb']}/query-data/get-started/`));
|
||||
} else {
|
||||
temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/guides\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/guides\//, `/influxdb/${latestVersions['influxdb']}/flux/guides/`));
|
||||
temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/introduction\//, `/influxdb/${latestVersions['influxdb']}/flux/`));
|
||||
temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//, `/influxdb/${latestVersions['influxdb']}/flux/guides/`));
|
||||
temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//, `/influxdb/${latestVersions['influxdb']}/flux/`));
|
||||
}
|
||||
// Redirect Flux stdlib and language sections to v2 Flux docs
|
||||
temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/(?:functions|stdlib|language)\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\//, `/influxdb/${latestVersions['influxdbv2']}/reference/flux/`));
|
||||
temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/(?:functions|stdlib|language)\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\//, `/influxdb/${latestVersions['influxdbv2']}/reference/flux/`));
|
||||
|
||||
// Redirect versionless and base version to v2 Flux docs
|
||||
temporaryRedirect(/^\/flux\/(?:v0\.[0-9]{1,2}\/|)$/.test(request.uri), `/influxdb/${latestVersions['influxdbv2']}/reference/flux/`);
|
||||
|
|
Loading…
Reference in New Issue