feat: www <-> non-www redirection

This commit is contained in:
Andras Bacsai
2022-02-13 22:56:37 +01:00
parent 69d3cb5dd8
commit aec1d184c8
11 changed files with 90 additions and 45 deletions

View File

@@ -4,7 +4,7 @@ import { promises as fs } from 'fs';
import yaml from 'js-yaml';
import type { RequestHandler } from '@sveltejs/kit';
import { letsEncrypt } from '$lib/letsencrypt';
import { configureSimpleServiceProxyOn, reloadHaproxy } from '$lib/haproxy';
import { configureSimpleServiceProxyOn, reloadHaproxy, setWwwRedirection } from '$lib/haproxy';
import { getDomain } from '$lib/components/common';
import { PrismaErrorHandler } from '$lib/database';
@@ -117,6 +117,7 @@ export const post: RequestHandler = async (event) => {
if (isHttps) {
await letsEncrypt({ domain, id });
}
await setWwwRedirection(fqdn);
await reloadHaproxy(destinationDocker.engine);
return {
status: 200