Compliance-Kern: HTTPS-Erzwingung, Datenschutzlink im Buchungsformular, signierte Links/Feeds von Adress-Weiterleitung ausnehmen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m39s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m39s
- ForceHttps-Middleware (abschaltbar per FEWO_FORCE_HTTPS) - Datenschutzerklaerung im Buchungsformular verlinkt - ResolveTheme: angebot/bewertung/angebote/kalender/automation/health bleiben auf der aufgerufenen Adresse - Berichte MVP-TECHNICAL-GATE / MVP-COMPLIANCE-ACCEPTANCE, Regeln fuer parallele Agenten (ZUSAMMENARBEIT 7) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c9e6992f4
commit
545008baab
10 files changed
+575
-1
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Sends plain-HTTP requests to the same address over HTTPS. Done in the application (not in .htaccess) because on
|
||||
* Strato the .htaccess in the deploy folder is rewritten by every deployment; the application also sees the
|
||||
* cleaned request path, so no internal release folder can leak into the target address.
|
||||
*/
|
||||
class ForceHttps
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (! config('fewo.force_https') || $request->isSecure()) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
$target = 'https://'.$request->getHost().$request->getRequestUri();
|
||||
|
||||
// 308 keeps the method for automation callers (POST webhooks); browsers and crawlers get 301.
|
||||
return redirect()->away($target, in_array($request->getMethod(), ['GET', 'HEAD'], true) ? 301 : 308);
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,13 @@ public function handle(Request $request, Closure $next): Response
|
||||
$context->set($tenant);
|
||||
}
|
||||
|
||||
if ($this->staysOnRequestedAddress($request)) {
|
||||
URL::forceRootUrl($request->getSchemeAndHttpHost());
|
||||
URL::forceScheme($request->getScheme());
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
if ($redirect = $this->toMainAddress($request, $theme->site)) {
|
||||
return $redirect;
|
||||
}
|
||||
@@ -54,6 +61,17 @@ public function handle(Request $request, Closure $next): Response
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed links (offers, reviews, newsletter) are bound to the host they were issued for, and portals and
|
||||
* automations call feeds and endpoints under the address they were given. These paths are answered on the
|
||||
* address they came in on – a redirect to the main address would invalidate old signatures and feed URLs
|
||||
* after a change of the main address. Links on such a page keep the requested host (session, CSRF).
|
||||
*/
|
||||
private function staysOnRequestedAddress(Request $request): bool
|
||||
{
|
||||
return $request->is('angebot/*', 'bewertung/*', 'angebote/*', 'kalender/*', 'automation/*', 'health/*');
|
||||
}
|
||||
|
||||
/**
|
||||
* A website answers on one main address. Visitors coming in through a further address (e.g. www.…) are
|
||||
* sent there permanently – otherwise the page would load its scripts, fonts and videos from the main
|
||||
|
||||
Reference in new issue
Block a user