Hi all, I know this issue has been encounter by others before me but there doesn’t seem to be a concrete solution. Hopefully someone has a similar use set up as mine?
After setting up nginx to reverse proxy piwik over https only, I am getting the following login form error despite entering the correct credentials:
Here is my nginx configuration:
server {
listen 80;
listen [::]:80;
server_name 127.0.0.1;
return 301 https://$server_name$request_uri;
}
upstream app_servers {
server piwik;
}
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /run/secrets/ssl_cert;
ssl_certificate_key /run/secrets/priv_key;
location / {
proxy_pass http://app_servers;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host localhost;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host localhost;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
}
}
Piwik configuration:
[General]
assume_secure_protocol = 1
force_ssl = 1
proxy_host_headers[] = HTTP_X_FORWARDED_HOST
proxy_client_headers[] = HTTP_CLIENT_IP
proxy_client_headers[] = HTTP_X_FORWARDED_FOR
enable_trusted_host_check = 0
Docker-compose configuration:
version: "3.3"
services:
db:
image: mariadb:latest
volumes:
- /mnt:/var/lib/mysql
deploy:
replicas: 1
restart_policy:
condition: on-failure
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
MYSQL_DATABASE: piwik
secrets:
- db_root_password
piwik:
depends_on:
- db
image: piwik:latest
volumes:
- ./piwik/config.ini.php:/var/www/html/config/config.ini.php
deploy:
replicas: 3
restart_policy:
condition: on-failure
ports:
- 3000:80
nginx:
depends_on:
- piwik
image: nginx:latest
volumes:
- ./nginx/site.conf:/etc/nginx/conf.d/site.conf
deploy:
replicas: 3
restart_policy:
condition: any
max_attempts: 100
secrets:
- priv_key
- ssl_cert
ports:
- 443:443
secrets:
priv_key:
file: /etc/ssl/ssl.key
ssl_cert:
file: /etc/ssl/ssl.crt
db_root_password:
file: ./secrets/db_root_password.txt