neonail-database/fix-all-forms-https.sh
2025-08-10 18:09:07 +02:00

98 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
echo "🔒 Alle Formulare für HTTPS reparieren"
echo "====================================="
# 1. Laravel Cache komplett leeren
echo "🧹 Leere Laravel Cache..."
php artisan config:clear 2>/dev/null || echo "⚠️ config:clear übersprungen"
php artisan cache:clear 2>/dev/null || echo "⚠️ cache:clear übersprungen"
php artisan route:clear 2>/dev/null || echo "⚠️ route:clear übersprungen"
php artisan view:clear 2>/dev/null || echo "⚠️ view:clear übersprungen"
# 2. .env für HTTPS erzwingen
echo "📝 Erzwinge HTTPS in .env..."
sed -i 's|APP_URL=http://|APP_URL=https://|' .env
sed -i 's|APP_URL=https://192.168.30.81|APP_URL=https://neonail.vogt.de.com|' .env
# 3. Session-Konfiguration für HTTPS
echo "🔐 Konfiguriere Session für HTTPS..."
cat > config/session.php << 'EOF'
<?php
use Illuminate\Support\Str;
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => env('SESSION_CONNECTION'),
'table' => 'sessions',
'store' => env('SESSION_STORE'),
'lottery' => [2, 100],
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
'path' => '/',
'domain' => env('SESSION_DOMAIN'),
'secure' => true,
'http_only' => true,
'same_site' => 'lax',
];
EOF
# 4. AppServiceProvider für HTTPS erzwingen
echo "⚙️ Konfiguriere AppServiceProvider für HTTPS..."
cat > app/Providers/AppServiceProvider.php << 'EOF'
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Blade;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
// Erzwinge HTTPS in Produktion
if (config('app.env') === 'production') {
URL::forceScheme('https');
}
// Blade-Directive für sichere URLs
Blade::directive('secureUrl', function ($expression) {
return "<?php echo secure_url($expression); ?>";
});
}
}
EOF
# 5. Apache neu laden
echo "🔄 Lade Apache neu..."
systemctl reload apache2
# 6. Test
echo "🧪 Teste HTTPS-Konfiguration..."
curl -I https://neonail.vogt.de.com
echo ""
echo "✅ Alle Formulare für HTTPS repariert!"
echo "📋 Testen Sie: https://neonail.vogt.de.com"
echo ""
echo "📋 Falls Warnung bleibt:"
echo "1. Safari-Cache leeren (Cmd+Shift+R)"
echo "2. Private-Fenster testen"
echo "3. Safari-Einstellungen: Entwickler > Leere Caches"
echo "4. Safari-Einstellungen: Datenschutz > Website-Daten verwalten"
echo "5. Safari komplett neu starten"