diff --git a/api/index.ts b/api/index.ts index 72dce4c..358e201 100644 --- a/api/index.ts +++ b/api/index.ts @@ -1,8 +1,8 @@ -import http from 'http'; import { createTerminus } from '@godaddy/terminus'; import * as Sentry from '@sentry/node'; import * as Tracing from '@sentry/tracing'; import express from 'express'; +import http from 'http'; import morgan from 'morgan'; import vhost from 'vhost'; import { refreshApps, stopAppsRefresh } from './apps/index.js'; @@ -63,6 +63,13 @@ switch (process.env.VHOST) { res.redirect('https://app.destinyitemmanager.com' + req.originalUrl); }), ); + app.use( + vhost('pr.dim.gg', (req, res) => { + // Instruct CF to cache for 15 minutes + res.set('Cache-Control', 'max-age=900'); + res.redirect('https://pr.destinyitemmanager.com' + req.originalUrl); + }), + ); } break; } diff --git a/kubernetes/ingress.yaml b/kubernetes/ingress.yaml index c4c9451..c989b00 100644 --- a/kubernetes/ingress.yaml +++ b/kubernetes/ingress.yaml @@ -49,6 +49,7 @@ spec: - www.dim.gg - app.dim.gg - beta.dim.gg + - pr.dim.gg secretName: dim-gg-tls rules: - host: dim.gg @@ -81,4 +82,14 @@ spec: name: dim-api port: number: 80 + - host: pr.dim.gg + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: dim-api + port: + number: 80 ingressClassName: nginx