Force HTTPS from the admin, with a probe before and after
System > HTTPS and cms:https switch the redirect lines in public/.htaccess only when the site answers over HTTPS, and take them back on a loop. HSTS is a separate second switch. The redirect block moves before the front controller rules, where it never reached pages, and .well-known is no longer denied, so the origin probe works on Apache. The Git updater keeps switched-on lines like the archive update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
daad5a1740
commit
8b212d5cc9
15 files changed
+614
-24
No files matched your search
@@ -64,6 +64,35 @@
|
||||
<br><span class="muted">Eingestellt in der Server-Umgebung; sie hat Vorrang vor <code>.env</code> und lässt sich nur beim Hoster ändern.</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{# HTTPS erzwingen (ADR 120): schaltet die Zeilen in public/.htaccess, mit Probe davor
|
||||
und danach. HSTS erst als zweiter Schritt. #}
|
||||
<dt>HTTPS</dt>
|
||||
<dd>
|
||||
{% if https.redirect %}
|
||||
<strong>Wird erzwungen.</strong> <span class="muted">– http:// leitet mit 301 auf HTTPS um.</span>
|
||||
{% elseif origin.adresse starts with 'https://' %}
|
||||
<span class="check-bad"><strong>Nicht erzwungen.</strong></span> <span class="muted">– die Website ist auch über http:// erreichbar, ohne Umleitung.</span>
|
||||
{% else %}
|
||||
<strong>Nicht erzwungen.</strong> <span class="muted">– erst die Adresse mit https:// eintragen.</span>
|
||||
{% endif %}
|
||||
{% if https.redirect %}<br>HSTS: {% if https.hsts %}<strong>eingeschaltet</strong> <span class="muted">– Browser bleiben ein Jahr lang bei HTTPS, Subdomains eingeschlossen.</span>{% else %}<span class="muted">aus. Erst einschalten, wenn HTTPS ein paar Tage gut läuft: Ein Browser merkt sich HSTS ein Jahr lang, das lässt sich nicht zurücknehmen.</span>{% endif %}{% endif %}
|
||||
{% if not https.found %}
|
||||
<br><span class="muted">Die Zeilen dafür stehen nicht in <code>public/.htaccess</code> – geändert oder eine alte Fassung. Das nächste Update bringt sie zurück.</span>
|
||||
{% elseif not https.writable %}
|
||||
<br><span class="muted">PHP darf <code>public/.htaccess</code> nicht schreiben. Von Hand: das <code>#</code> vor den drei Zeilen unter „HTTPS erzwingen“ entfernen.</span>
|
||||
{% else %}
|
||||
<form class="https-actions" action="{{ path('admin_system_https') }}" method="post">
|
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token('system') }}">
|
||||
{% if not https.redirect %}
|
||||
<button class="secondary" type="submit" name="action" value="redirect-an"{% if not (origin.adresse starts with 'https://') %} disabled{% endif %}>HTTPS erzwingen</button>
|
||||
{% else %}
|
||||
{% if not https.hsts %}<button class="secondary" type="submit" name="action" value="hsts-an">HSTS einschalten</button>{% else %}<button class="secondary" type="submit" name="action" value="hsts-aus">HSTS ausschalten</button>{% endif %}
|
||||
<button class="secondary" type="submit" name="action" value="redirect-aus">Umleitung ausschalten</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% if not https.redirect and origin.adresse starts with 'https://' %}<p class="field-help">Vorher wird geprüft, ob {{ origin.adresse }} mit gültigem Zertifikat hier ankommt, danach, ob sie es weiterhin tut. Klappt das nicht, bleibt alles, wie es war.</p>{% endif %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% if state.worktree %}
|
||||
<dt>Stand</dt><dd><code>{{ state.describe }}</code>{% if state.commit != 'unbekannt' %} · Commit <code>{{ state.commit }}</code>{% endif %}</dd>
|
||||
{% else %}
|
||||
|
||||
Reference in new issue
Block a user