I have an Apache server that is behind Traefik. Now I want to get the user's IP, but I only get the container's internal IP.
I control all containers via a docker-compose file
docker-compose.yml:
app:
image: traefik:1.7.20-alpine
restart: always
ports:
- "MyIP:80:80"
- "MyIP:443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.toml:/traefik.toml
- ./acme.json:/acme.json
networks:
- webserver
Apache-Server:
build: ./apache/
networks:
- webserver
labels:
- "traefik.frontend.rule=Host:MyWebsite.tld"
- "traefik.enable=true"
links:
- mysql:db
volumes:
- ./apache/public/:/var/www/html/:rw
restart: always
Dockerfile:
FROM php:7.1-apache
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get install libpng-dev -y
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install gd
How can I pass the real user IP?