Skip to content

Commit 364d575

Browse files
author
Lynette Nguyen
committed
Add URL redirects for server-side routing
1 parent b1e9db5 commit 364d575

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

terraform/lambdas/redirect-spa.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
function handler(event) {
44
var request = event.request;
5+
var headers = request.headers;
6+
var host = headers.host && headers.host.value ? headers.host.value : 'research-hub.auckland.ac.nz'; // replace with hardcoded host
7+
8+
9+
if (request.uri === '/service/media-productions') { //SCTASK0366067
10+
return {
11+
statusCode: 302,
12+
statusDescription: 'Found',
13+
headers: { 'location': { 'value' : 'https://www.auckland.ac.nz/en/intranet/services/buying-payment/approved-suppliers/photographers-videographers-designers.html' } }
14+
};
15+
}
16+
17+
if (request.uri === '/platforms' || request.uri === '/article/share') { //SCTASK0366060, RSM-4221
18+
return {
19+
statusCode: 302,
20+
statusDescription: 'Found',
21+
headers: { 'location': { 'value' : `https://${host}/subhub/research-platforms` } }
22+
}
23+
}
24+
525

626
if (!hasExtension(request.uri)) {
727
request.uri = '/index.html';

0 commit comments

Comments
 (0)