diff --git a/.htaccess b/.htaccess index d7dfd05..df08ac6 100644 --- a/.htaccess +++ b/.htaccess @@ -14,8 +14,9 @@ RewriteEngine On Require all denied -# Force HTTPS +# Force HTTPS (skip when terminated TLS is forwarded — Traefik, Caddy, NPM, …) RewriteCond %{HTTPS} !=on +RewriteCond %{HTTP:X-Forwarded-Proto} !^https$ [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # API routing diff --git a/CHANGELOG.md b/CHANGELOG.md index ee4d672..065677d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **Recipe scraps tips** — During cooking steps, detect "waste" generated (peels, cores, bones, eggshells, coffee grounds, citrus zest, etc.) and surface AI-powered tips on how to reuse them (compost, natural cleaner, broth, candied peel, etc.). Could be shown as an optional collapsible hint card below the step that generates the scrap. +## [1.7.41] - 2026-06-08 + +### Fixed +- **Docker/Traefik “Impossibile contattare il server”** — PHP 8.2 deprecation notices (`LoggingPDO::prepare`) were emitted as HTML before JSON, breaking `fetch().json()` on the startup health check; API bootstrap now suppresses HTML error output in production. +- **Traefik HTTPS redirect loop** — `.htaccess` skips the HTTPS redirect when `X-Forwarded-Proto: https` is already set (compatible with Traefik `sslheader` middleware); no need to disable `.htaccess` manually. +- **LoggingPDO PHP 8.2** — `#[\ReturnTypeWillChange]` on `prepare()` to eliminate deprecation noise in error logs. + ## [1.7.40] - 2026-06-08 ### Added diff --git a/README.md b/README.md index 77281dc..c70247d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ [![SQLite](https://img.shields.io/badge/SQLite-3-blue.svg)](https://www.sqlite.org/) [![Docker](https://img.shields.io/badge/Docker-Ready-2496ED.svg)](Dockerfile) [![i18n](https://img.shields.io/badge/i18n-IT%20%7C%20EN%20%7C%20DE%20%7C%20FR%20%7C%20ES-orange.svg)](translations/) -[![Version](https://img.shields.io/badge/version-1.7.40-brightgreen.svg)](CHANGELOG.md) +[![Version](https://img.shields.io/badge/version-1.7.41-brightgreen.svg)](CHANGELOG.md) [![GitHub stars](https://img.shields.io/github/stars/dadaloop82/EverShelf?style=social)](https://github.com/dadaloop82/EverShelf/stargazers) [![Last commit](https://img.shields.io/github/last-commit/dadaloop82/EverShelf/main)](https://github.com/dadaloop82/EverShelf/commits/main) [![Contributors](https://img.shields.io/github/contributors/dadaloop82/EverShelf)](https://github.com/dadaloop82/EverShelf/graphs/contributors) diff --git a/api/bootstrap.php b/api/bootstrap.php index bf8658b..9ad9966 100644 --- a/api/bootstrap.php +++ b/api/bootstrap.php @@ -2,6 +2,11 @@ /** * EverShelf API bootstrap — shared by HTTP router and cron. */ +// Never emit HTML notices before JSON API responses (breaks fetch().json() in the PWA). +if (!defined('CRON_MODE') && (getenv('DISPLAY_ERRORS') ?: '') !== '1') { + ini_set('display_errors', '0'); + ini_set('html_errors', '0'); +} require_once __DIR__ . '/lib/env.php'; require_once __DIR__ . '/lib/constants.php'; require_once __DIR__ . '/lib/github.php'; diff --git a/api/logger.php b/api/logger.php index 815d344..6f2a04f 100644 --- a/api/logger.php +++ b/api/logger.php @@ -335,6 +335,7 @@ class LoggingPDOStatement { // Type hint: use PDO in all functions (LoggingPDO extends PDO). // ═══════════════════════════════════════════════════════════════════════════ class LoggingPDO extends \PDO { + #[\ReturnTypeWillChange] public function prepare(string $query, array $options = []): LoggingPDOStatement|false { $stmt = parent::prepare($query, $options); if ($stmt === false) { diff --git a/index.html b/index.html index 04e4a5d..dc59589 100644 --- a/index.html +++ b/index.html @@ -94,7 +94,7 @@ - v1.7.40 + v1.7.41 @@ -107,7 +107,7 @@

- EverShelfv1.7.40 + EverShelfv1.7.41

diff --git a/manifest.json b/manifest.json index 8a4bed0..79ceb2c 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "EverShelf", "short_name": "EverShelf", "description": "Gestione completa della dispensa di casa con scansione barcode", - "version": "1.7.40", + "version": "1.7.41", "start_url": "/evershelf/", "display": "standalone", "background_color": "#f0f4e8",