diff --git a/dashboard/src/components/app/Security.vue b/dashboard/src/components/app/Security.vue index 850794f1d..839374374 100644 --- a/dashboard/src/components/app/Security.vue +++ b/dashboard/src/components/app/Security.vue @@ -16,6 +16,7 @@ const busy = ref(false); const robotsTxt = ref(''); const csp = ref(''); const hstsPreload = ref(false); +const submitError = ref({ robotsTxt: '', csp: '' }); function addRobotsTxtPreset(pattern) { if (robotsTxt.value) robotsTxt.value += '\n'; @@ -45,6 +46,7 @@ const commonCspMenu = [ async function onSubmit() { busy.value = true; + submitError.value = {}; const data = { robotsTxt: robotsTxt.value || null, // empty string resets @@ -53,7 +55,11 @@ async function onSubmit() { }; const [error] = await appsModel.configure(props.app.id, 'reverse_proxy', data); - if (error) return console.error(error); + if (error) { + if (error.body?.message.includes('CSP')) submitError.value.csp = error.body.message; + else if (error.body?.includes('robots')) submitError.value.robotsTxt = error.body.message; + else submitError.value.csp = JSON.stringify(error); + } busy.value = false; } @@ -69,7 +75,7 @@ onMounted(() => {