From 7186d461961ee14aa680095a9061a07f50aff57d Mon Sep 17 00:00:00 2001 From: "n.siegfried" Date: Mon, 15 Jun 2026 10:28:50 -0700 Subject: [PATCH] Wire feedback to IIS reverse-proxy -> Power Automate - Set FEEDBACK_ENDPOINT to same-origin /api/feedback (no CORS, hides trigger URL) - Add web.config with ARR/URL-Rewrite proxy rule (placeholder trigger URL), HTTPS/POST/static-content setup - DEPLOYMENT.md: concrete IIS + Power Automate steps and the HTTP-trigger Request Body JSON Schema matching the app payload Co-Authored-By: Claude Opus 4.8 (1M context) --- DEPLOYMENT.md | 53 +++++++++++++++++++++++++++++++++++---- feedback-config.js | 8 +++++- web.config | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 web.config diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 12e99dd..d95c81a 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -78,12 +78,55 @@ app.listen(8080); Each line of `feedback.jsonl` is one submission; download it anytime. (PHP/ Python/ASP.NET equivalents are a few lines too.) -#### Option B — Microsoft Power Automate → SharePoint / Excel (good fit for M365) +#### Option B — Internal IIS reverse proxy → Power Automate (the chosen setup) + +The browser posts to a **same-origin** path `/api/feedback`; IIS forwards that to +the Power Automate trigger. This avoids CORS entirely and keeps the secret +trigger URL off the client. `FEEDBACK_ENDPOINT` is already set to +`/api/feedback`, and [`web.config`](web.config) contains the proxy rule. + +**On the IIS box (one-time, server admin):** +1. Install the **URL Rewrite** and **Application Request Routing (ARR)** modules. +2. Enable the proxy: IIS Manager → server node → *Application Request Routing + Cache* → *Server Proxy Settings* → check **Enable proxy**. +3. Bind the site to **HTTPS** with an internal certificate. +4. In `web.config`, replace `POWER_AUTOMATE_TRIGGER_URL` with the real trigger + URL (write every `&` as `&`). + +**In Power Automate:** 1. Create a flow with the **"When an HTTP request is received"** trigger. -2. Paste its generated URL into `FEEDBACK_ENDPOINT`. -3. Add an action: **Add a row into a table** (Excel) or **Create item** - (SharePoint list), mapping the JSON fields (`type`, `name`/`author`, `text`, - `submittedAt`, `page`, …). +2. Set its **Request Body JSON Schema** to: + + ```json + { + "type": "object", + "properties": { + "app": { "type": "string" }, + "page": { "type": "string" }, + "submittedAt": { "type": "string" }, + "type": { "type": "string" }, + "name": { "type": "string" }, + "author": { "type": "string" }, + "text": { "type": "string" }, + "step": { "type": "integer" }, + "view": { "type": "string" }, + "timestamp": { "type": "string" }, + "ts": { "type": "string" }, + "id": { "type": "string" }, + "clientId": { "type": "string" } + } + } + ``` + > `name` is used by the home/SOP forms, `author` by the Work Package Creator. + > Map both into one "Submitted by" column with an expression like + > `coalesce(triggerBody()?['name'], triggerBody()?['author'])`. +3. Add an action — **Create item** (SharePoint list) or **Add a row into a + table** (Excel / Dataverse) — mapping the fields above. +4. Save; copy the generated **HTTP POST URL** into `web.config` + (`POWER_AUTOMATE_TRIGGER_URL`). +5. A Power App (or just the list/Excel) reads that store to show live comments. + +Chain: `browser → /api/feedback (IIS proxy) → Power Automate → SharePoint/Dataverse → Power App`. The "downloadable file" is then just the Excel/SharePoint list, viewable live or exported — all inside your corporate cloud. diff --git a/feedback-config.js b/feedback-config.js index 8a0dad5..4879a34 100644 --- a/feedback-config.js +++ b/feedback-config.js @@ -15,8 +15,14 @@ Leave it as an empty string to stay fully local (export/import only). See DEPLOYMENT.md for setup details and sample receivers. + + This is set to the same-origin path '/api/feedback', which the IIS reverse + proxy (see web.config) forwards to the Power Automate HTTP trigger. Keeping it + relative means no CORS and the secret trigger URL never appears in client + code. Locally (no proxy) the POST simply fails silently and feedback is still + saved/exported from the browser. ────────────────────────────────────────────────────────────────────────── */ -window.FEEDBACK_ENDPOINT = ''; +window.FEEDBACK_ENDPOINT = '/api/feedback'; /* Best-effort send to the central endpoint. Never throws and never blocks the UI: feedback is always saved locally first by the caller, so a failed or diff --git a/web.config b/web.config new file mode 100644 index 0000000..762d040 --- /dev/null +++ b/web.config @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +