Provide basePath support (#309)

* Provide basePath support

To be able to serve the application via a reverse proxy in a subfolder
smarty needs to be aware of the basepath if any.

* Provide basepath support via X-Forwarded headers

* Fix warnings

* Review adjustments

* Provide support X-Forwarded-Host header

* Use $uri in view factory directly

* Use middleware to set basepath from X-Forwarded-Path header

* Fix invalid type hint in RouterPathMiddleware

* Add "X-Forwarded-Host" to README
This commit is contained in:
bellington3 2020-10-19 20:18:03 +00:00 committed by GitHub
parent 234ecc2c6d
commit c5298dd24b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 2 deletions

View file

@ -10,6 +10,7 @@ use Alltube\ErrorHandler;
use Alltube\LocaleManagerFactory;
use Alltube\LocaleMiddleware;
use Alltube\LoggerFactory;
use Alltube\RouterPathMiddleware;
use Alltube\ViewFactory;
use Slim\App;
use Slim\Container;
@ -31,7 +32,9 @@ try {
// Locales.
$container['locale'] = LocaleManagerFactory::create();
$app->add(new LocaleMiddleware($container));
$app->add(new RouterPathMiddleware($container));
// Smarty.
$container['view'] = ViewFactory::create($container);