jQeury error! when behind loadbalancer
Request for help using phpIPAM / Misc question? ... The issue is that when I go to the website, it appears that none of the CSS or other scripts load.
I've mostly followed instructions on https://hub.docker.com/r/phpipam/phpipam-www with some tweaks and so here's my compose file:
# WARNING: Replace the example passwords with secure secrets.
# WARNING: 'my_secret_phpipam_pass' and 'my_secret_mysql_root_pass'
version: '3'
services:
phpipam-web:
image: phpipam/phpipam-www:latest
environment:
- TZ=Canada/Pacific
- IPAM_DATABASE_HOST=phpipam-mariadb
- IPAM_DATABASE_PASS=**********************
- IPAM_DATABASE_WEBHOST=%
restart: unless-stopped
volumes:
- phpipam-logo:/phpipam/css/images/logo
- phpipam-ca:/usr/local/share/ca-certificates:ro
depends_on:
- phpipam-mariadb
phpipam-cron:
image: phpipam/phpipam-cron:latest
environment:
- TZ=Canada/Pacific
- IPAM_DATABASE_HOST=phpipam-mariadb
- IPAM_DATABASE_PASS=********************
- SCAN_INTERVAL=1h
restart: unless-stopped
volumes:
- phpipam-ca:/usr/local/share/ca-certificates:ro
depends_on:
- phpipam-mariadb
phpipam-mariadb:
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=*******************
restart: unless-stopped
volumes:
- phpipam-db-data:/var/lib/mysql
phpipam-haproxy
image: haproxy:latest
ports:
- "80:80"
- "443:443"
- "8404:8404"
volumes:
- /etc/ssl/certs:/etc/ssl/certs:ro
- /usr/local/etc/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
volumes:
phpipam-db-data:
phpipam-logo:
phpipam-ca:
I've run into the exact same issue with both HAProxy in a container in front, as well as an NGINX, so I'm convinced there's a configuration issue in phpipam that I'm not seeing. I am currently running all my containers on a debian server.
Thanks in advance
You'll need to set the environment variable IPAM_TRUST_X_FORWARDED=true and ensure the associated HTTP headers are filtered/set correctly by your reverse-proxy.
/** CONFIG.DIST.PHP
* Reverse proxy settings
*
* If operating behind a reverse proxy set $trust_x_forwarded_headers=true; to accept the following headers
*
* WARNING! These headers should be filtered and/or overwritten by the reverse-proxy to avoid potential abuse by end-clients.
*
* X_FORWARDED_FOR
* X_FORWARDED_HOST
* X_FORWARDED_PORT
* X_FORWARDED_PROTO
* X_FORWARDED_SSL
* X_FORWARDED_URI
*/
$trust_x_forwarded_headers = false;
spot on @GaryAllan thank you. Issue is resolved
Do you know where could I have found that answer?
Hi @GaryAllan , I am also facing same jquery error , could you please let me know what changes to be done and where , which file with file path .
Thanks !
@Jayesh00 I added IPAM_TRUST_X_FORWARDED=true to my environment variables in the compose file.
Adding it to the environment has fixed mine as well. I run behind an nginx container.