Docker Symfony APIs deployed on host cannot find his resources after Apache2 ProxyPass configuration

  apache, docker, nginx, php, symfony

I am not sure this the best practices for the project, so be kind !


On my laptop for the simulation (Ubuntu 20.4), but this is the same interactions on a remote server.

I have 2 distinct Symfony APIs (ApiPlatform), api1 and api2 running with docker-compose so 6 containers (api1_php-fpm, api1_nginx, api1_mariadb, api2_php-fpm, api2_nginx, api2_mariadb).

I have one server host with an Apache Server that redirect connections via ProxyPass /etc/apache2/apach2.conf:

# API 1
ProxyPass /api1
ProxyPassReverse /api1

# API 2
ProxyPass /api2
ProxyPassReverse /api2


When the APIs are docker-compose up, I can contact them via http://localhost:8787/api and http://localhost:8989/api thanks to docker configuration ports.

My wish is to contact the APIs with the specific URLs defined in the apache2.conf : http://localhost/api1/api or http://localhost/api2/api.
But they cannot find the correct path to their resources (see below).

Symfony error due to proxypass

What is the config I have to change ? Apache Host, Apache in docker php-fpm, Nginx in docker nginx ?

Thanks for reading.

Source: Symfony Questions