testing traefik stuff

This commit is contained in:
Andras Bacsai 2022-09-06 09:30:13 +02:00
parent 9acd5c94e8
commit 1f73b83a79
4 changed files with 10 additions and 3 deletions

View File

@ -96,6 +96,12 @@ fastify.register(autoLoad, {
fastify.register(cookie)
fastify.register(cors);
fastify.addHook('onRequest', async (request, reply) => {
console.log({ host: request.headers.host, origin: request.headers.origin })
if (!request.headers.origin && !request.headers.host.startsWith('host.docker.internal')) {
throw new Error('Invalid origin');
}
})
fastify.listen({ port, host }, async (err: any, address: any) => {
if (err) {
console.error(err);

View File

@ -21,7 +21,7 @@ import { scheduler } from './scheduler';
import { supportedServiceTypesAndVersions } from './services/supportedVersions';
import { includeServices } from './services/common';
export const version = '3.9.0';
export const version = '3.9.1';
export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr';

View File

@ -1,4 +1,5 @@
import { FastifyPluginAsync } from 'fastify';
import { OnlyId } from '../../../types';
import { remoteTraefikConfiguration, traefikConfiguration, traefikOtherConfiguration } from './handlers';
import { TraefikOtherConfiguration } from './types';
@ -6,7 +7,7 @@ const root: FastifyPluginAsync = async (fastify): Promise<void> => {
fastify.get('/main.json', async (request, reply) => traefikConfiguration(request, reply));
fastify.get<TraefikOtherConfiguration>('/other.json', async (request, reply) => traefikOtherConfiguration(request));
fastify.get('/remote/:id', async (request) => remoteTraefikConfiguration(request));
fastify.get<OnlyId>('/remote/:id', async (request) => remoteTraefikConfiguration(request));
};
export default root;

View File

@ -1,7 +1,7 @@
{
"name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.9.0",
"version": "3.9.1",
"license": "Apache-2.0",
"repository": "github:coollabsio/coolify",
"scripts": {