fix: web.config inheritInChildApplications, form error messages, docs infra
- web.config: aggiunto inheritInChildApplications=false per evitare che rewrite rules e httpErrors si propaghino alle Virtual Applications figlie - contatti.astro: errori HTTP 400 mostrano il messaggio specifico dell'API invece del messaggio generico - docs/INFRA.md: documentazione infrastruttura IIS e procedura di deploy Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
90
docs/INFRA.md
Normal file
90
docs/INFRA.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Infrastruttura — SmartRootsSite
|
||||
|
||||
## Overview
|
||||
|
||||
Sito istituzionale statico generato con **Astro 4**, deployato su **IIS / Windows Server 2016** presso Hetzner.
|
||||
|
||||
- URL: https://www.smart-roots.net/
|
||||
- Cartella sul server: `C:\inetpub\wwwroot\smartroots-site\`
|
||||
- Backend API: https://api.smart-roots.net/ (progetto SmartRootsServices)
|
||||
|
||||
---
|
||||
|
||||
## Struttura IIS — Site `smart-roots`
|
||||
|
||||
Il Site IIS `smart-roots` ha come Physical Path `C:\inetpub\wwwroot\smartroots-site\`.
|
||||
Sotto di esso convivono due tipi di nodi:
|
||||
|
||||
### Virtual Applications (webapp con proprio App Pool)
|
||||
Sopravvivono automaticamente al cambio di Physical Path del Site.
|
||||
|
||||
`/investirehub`, `/mantis`, `/motoregrafico`, `/olympiadocs`, `/reports`, `/services`,
|
||||
`/smartreports`, `/smartwiki`, `/testblazor`, `/tradingview`, `/wiki`, `/zertimporter`
|
||||
|
||||
### Virtual Directories (contenuto statico, nessun App Pool)
|
||||
Vanno ricreate manualmente se si cambia la Physical Path del Site.
|
||||
Puntano tutte a sottocartelle di `C:\inetpub\wwwroot\smart-roots.net\`.
|
||||
|
||||
| Alias | Physical path |
|
||||
|---|---|
|
||||
| `.well-known` | `...\smart-roots.net\.well-known\` — ⚠️ necessario per rinnovo SSL |
|
||||
| `allegati` | `...\smart-roots.net\allegati\` |
|
||||
| `Images` | `...\smart-roots.net\Images\` |
|
||||
| `Pdf` | `...\smart-roots.net\Pdf\` |
|
||||
| `PricerApi` | `...\smart-roots.net\PricerApi\` |
|
||||
| `PricerApp` | `...\smart-roots.net\PricerApp\` |
|
||||
| `PricerApp2` | `...\smart-roots.net\PricerApp2\` |
|
||||
| `video` | `...\smart-roots.net\video\` |
|
||||
|
||||
---
|
||||
|
||||
## Deploy (da ripetere ad ogni aggiornamento)
|
||||
|
||||
```powershell
|
||||
npm run build
|
||||
Copy-Item -Path "dist\*" -Destination "C:\inetpub\wwwroot\smartroots-site\" -Recurse -Force
|
||||
```
|
||||
|
||||
Nessuna modifica IIS necessaria per i deploy ordinari.
|
||||
|
||||
---
|
||||
|
||||
## web.config — nota critica
|
||||
|
||||
Il file `public/web.config` (copiato da Astro in `dist/` durante la build) contiene:
|
||||
|
||||
1. **Redirect HTTP→HTTPS**
|
||||
2. **Astro static routing** — fallback catch-all che riscrive URL senza file fisico a `/{path}/index.html`
|
||||
3. **httpErrors 404** — serve `/index.html` per qualsiasi 404
|
||||
|
||||
L'intera sezione `<system.webServer>` è avvolta in:
|
||||
|
||||
```xml
|
||||
<location path="." inheritInChildApplications="false">
|
||||
```
|
||||
|
||||
**Questo wrapper è fondamentale.** Senza di esso, le regole di rewrite e il gestore 404
|
||||
vengono ereditati dalle Virtual Applications figlie, che ricevono traffico riscritto
|
||||
o risposte sostituite con la homepage Astro invece dei loro contenuti.
|
||||
|
||||
Sintomo senza il wrapper: endpoint dinamici delle webapp (es. `/smartreports/api/report?p=...`)
|
||||
restituiscono la homepage Astro invece del contenuto atteso.
|
||||
|
||||
---
|
||||
|
||||
## Pagine
|
||||
|
||||
| URL | File |
|
||||
|---|---|
|
||||
| `/` | `src/pages/index.astro` |
|
||||
| `/contatti` | `src/pages/contatti.astro` |
|
||||
| `/privacy` | `src/pages/privacy.astro` |
|
||||
| `/termini` | `src/pages/termini.astro` |
|
||||
|
||||
## API usate dal frontend
|
||||
|
||||
| Endpoint | Metodo | Scopo |
|
||||
|---|---|---|
|
||||
| `https://api.smart-roots.net/api/contatti` | POST | Invio form contatti |
|
||||
|
||||
Il controller è in `SmartRootsServices/SRServices/Controllers/SmartRootsSite/ContattiController.cs`.
|
||||
Reference in New Issue
Block a user