implement PUBLIC_APP_DOMAIN v1

This commit is contained in:
Ruben Fiszel
2025-11-11 19:27:54 +00:00
parent da102a11db
commit 1270db044e
5 changed files with 29 additions and 10 deletions
+14 -1
View File
@@ -62,7 +62,10 @@ use tower_http::{
};
use windmill_common::db::UserDB;
use windmill_common::worker::CLOUD_HOSTED;
use windmill_common::{utils::{configure_client, GIT_VERSION}, BASE_URL, INSTANCE_NAME};
use windmill_common::{
utils::{configure_client, GIT_VERSION},
BASE_URL, INSTANCE_NAME,
};
use crate::scim_oss::has_scim_token;
use windmill_common::error::AppError;
@@ -180,6 +183,7 @@ pub mod workspaces_ee;
mod workspaces_export;
mod workspaces_extra;
mod workspaces_oss;
mod public_app_layer;
#[cfg(feature = "mcp")]
mod mcp;
@@ -699,6 +703,15 @@ pub async fn run_server(
)
};
let app = if let Some(domain) = public_app_layer::PUBLIC_APP_DOMAIN.as_ref() {
tracing::info!("Public app domain filter enabled for domain: {}", domain);
app.layer(axum::middleware::from_fn(
public_app_layer::public_app_domain_filter,
))
} else {
app
};
let app = app.layer(CatchPanicLayer::custom(|err| {
tracing::error!("panic in handler, returning 500: {:?}", err);
Response::builder()
+10 -6
View File
@@ -16,7 +16,7 @@
import { sendUserToast } from '$lib/toast'
import { isCloudHosted } from '$lib/cloud'
import { refreshSuperadmin } from '$lib/refreshUser'
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
import { onDestroy, onMount } from 'svelte'
import Skeleton from './common/skeleton/Skeleton.svelte'
import Button from './common/button/Button.svelte'
@@ -27,6 +27,7 @@
error?: string | undefined
popup?: boolean
firstTime?: boolean
onLoginSuccess?: () => void
}
let {
@@ -35,7 +36,8 @@
password = $bindable(undefined),
error = undefined,
popup = false,
firstTime = false
firstTime = false,
onLoginSuccess = undefined
}: Props = $props()
const providers = [
@@ -200,8 +202,6 @@
}
}
const dispatch = createEventDispatcher()
onMount(() => {
try {
localStorage.removeItem('closeUponLogin')
@@ -212,19 +212,23 @@
function popupListener(event) {
let data = event.data
console.log('popupListener', data, event.origin, window.location.origin)
if (event.origin !== window.location.origin) {
return
}
processPopupData(data)
window.removeEventListener('message', popupListener)
if (data.type === 'success' || data.type === 'error') {
console.log('Removing popup listener')
window.removeEventListener('message', popupListener)
}
}
function processPopupData(data) {
if (data.type === 'error') {
sendUserToast(data.error, true)
} else if (data.type === 'success') {
dispatch('login')
onLoginSuccess?.()
}
}
+2 -1
View File
@@ -139,7 +139,8 @@
<div class="px-2 mx-auto mt-20 max-w-xl w-full">
{#if !jwtError}
<Login
on:login={() => {
onLoginSuccess={() => {
// window.location.reload()
loadApp()
app = app
@@ -125,7 +125,8 @@
<div class="px-2 mx-auto mt-20 max-w-xl w-full">
{#if !jwtError}
<Login
on:login={() => {
onLoginSuccess={() => {
console.log('login')
// window.location.reload()
loadUser().then(() => {
loadApp()
+1 -1
View File
@@ -11,7 +11,7 @@ const version = JSON.parse(json)
const config = {
server: {
https: process.env.HTTPS === 'true',
allowedHosts: ['localhost', '127.0.0.1', '0.0.0.0', 'rubendev.wimill.xyz'],
allowedHosts: ['localhost', '127.0.0.1', '0.0.0.0', 'rubendev.wimill.xyz', 'windmill.xyz'],
port: 3000,
proxy: {
'^/api/w/[^/]+/s3_proxy/.*': {