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:
@@ -4,60 +4,62 @@
|
||||
Da copiare nella cartella /dist dopo il build: astro build
|
||||
-->
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<location path="." inheritInChildApplications="false">
|
||||
<system.webServer>
|
||||
|
||||
<!-- Routing: se il file non esiste fisicamente, serve index.html della directory -->
|
||||
<rewrite>
|
||||
<rules>
|
||||
<!-- Forza HTTPS -->
|
||||
<rule name="HTTP to HTTPS" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions>
|
||||
<add input="{HTTPS}" pattern="^OFF$" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
|
||||
</rule>
|
||||
<!-- Routing: se il file non esiste fisicamente, serve index.html della directory -->
|
||||
<rewrite>
|
||||
<rules>
|
||||
<!-- Forza HTTPS -->
|
||||
<rule name="HTTP to HTTPS" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions>
|
||||
<add input="{HTTPS}" pattern="^OFF$" />
|
||||
</conditions>
|
||||
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
|
||||
</rule>
|
||||
|
||||
<!-- SPA/Static fallback: cartelle Astro con index.html -->
|
||||
<rule name="Astro static routing" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="/{R:1}/index.html" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
<!-- SPA/Static fallback: cartelle Astro con index.html -->
|
||||
<rule name="Astro static routing" stopProcessing="true">
|
||||
<match url="(.*)" />
|
||||
<conditions logicalGrouping="MatchAll">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
||||
</conditions>
|
||||
<action type="Rewrite" url="/{R:1}/index.html" />
|
||||
</rule>
|
||||
</rules>
|
||||
</rewrite>
|
||||
|
||||
<!-- MIME types aggiuntivi necessari per Astro -->
|
||||
<staticContent>
|
||||
<remove fileExtension=".webmanifest" />
|
||||
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
|
||||
<remove fileExtension=".woff2" />
|
||||
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
|
||||
<remove fileExtension=".woff" />
|
||||
<mimeMap fileExtension=".woff" mimeType="font/woff" />
|
||||
</staticContent>
|
||||
<!-- MIME types aggiuntivi necessari per Astro -->
|
||||
<staticContent>
|
||||
<remove fileExtension=".webmanifest" />
|
||||
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
|
||||
<remove fileExtension=".woff2" />
|
||||
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
|
||||
<remove fileExtension=".woff" />
|
||||
<mimeMap fileExtension=".woff" mimeType="font/woff" />
|
||||
</staticContent>
|
||||
|
||||
<!-- Cache control per asset statici -->
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<add name="X-Content-Type-Options" value="nosniff" />
|
||||
<add name="X-Frame-Options" value="SAMEORIGIN" />
|
||||
<add name="X-XSS-Protection" value="1; mode=block" />
|
||||
<add name="Referrer-Policy" value="strict-origin-when-cross-origin" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
<!-- Cache control per asset statici -->
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<add name="X-Content-Type-Options" value="nosniff" />
|
||||
<add name="X-Frame-Options" value="SAMEORIGIN" />
|
||||
<add name="X-XSS-Protection" value="1; mode=block" />
|
||||
<add name="Referrer-Policy" value="strict-origin-when-cross-origin" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
|
||||
<!-- Compressione gzip -->
|
||||
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
|
||||
<!-- Compressione gzip -->
|
||||
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
|
||||
|
||||
<!-- Errori personalizzati -->
|
||||
<httpErrors errorMode="Custom" existingResponse="Replace">
|
||||
<remove statusCode="404" />
|
||||
<error statusCode="404" path="/index.html" responseMode="ExecuteURL" />
|
||||
</httpErrors>
|
||||
<!-- Errori personalizzati -->
|
||||
<httpErrors errorMode="Custom" existingResponse="Replace">
|
||||
<remove statusCode="404" />
|
||||
<error statusCode="404" path="/index.html" responseMode="ExecuteURL" />
|
||||
</httpErrors>
|
||||
|
||||
</system.webServer>
|
||||
</system.webServer>
|
||||
</location>
|
||||
</configuration>
|
||||
|
||||
Reference in New Issue
Block a user