Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

testing traefik stuff

Andras Bacsai1f73b83a79ee
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 4b3b3998f0..7eb745ae1c 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -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);
diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts
index 90b35cd128..45f5135501 100644
--- a/apps/api/src/lib/common.ts
+++ b/apps/api/src/lib/common.ts
@@ -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';
diff --git a/apps/api/src/routes/webhooks/traefik/index.ts b/apps/api/src/routes/webhooks/traefik/index.ts
index f9c7ff4b85..3769c8eb3b 100644
--- a/apps/api/src/routes/webhooks/traefik/index.ts
+++ b/apps/api/src/routes/webhooks/traefik/index.ts
@@ -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;
diff --git a/package.json b/package.json
index 2e6c23ed4e..fc5b41203c 100644
--- a/package.json
+++ b/package.json
@@ -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": {