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>
28 lines
958 B
PHP
28 lines
958 B
PHP
<?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);
|
|
}
|
|
}
|