GTM Server Side Tagging - apache Error 400/500

Job ID: 35962729

Budget: €8 – €30 EUR

domain cardport.de (below example)
Special Chars removed for Editor (code below malformed)

Google Tag Manager - Server Side Tagging

Problem: GTM call results in different Server Errors (500, 400).
Requirement: GTM call results in OK 200 OK

There are live and preview servers as suggested by Google. GTM Tags an Triggers are configured
GTM runs with Docker, Apache 2, website (Magento 2) uses varnish cache

Apache 2 - GTM Live Server results:
https://gtm.example.de/healthz = 200
https://gtm.example.de/gtm.js = 400 Bad Request
https://gtm.example.de/gtm/debug?id=GTM-52TMMZXm_auth=XXXXXXm_preview=env-3 = 500
Internal Server Error

Apache 2 - GTM Preview Server is working:
https://gtmvorschau.example.de/healthz = 200
https://gtmvorschau.example.de/gtm/debug?id=GTM-52TMMZXm_auth=XXXXXXm_preview=env-3 = 200

Docker:
docker run -d --name gtm-vorschau -p 127.0.0.1:8075:8080 -e CONTAINER_CONFIG='XXXXX' -e RUN_AS_PREVIEW_SERVER='true' gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
docker run -d --name gtm -p 127.0.0.1:8076:8080 -e CONTAINER_CONFIG='XXXXX' -e PREVIEW_SERVER_URL='https://gtmvorschau.example.de' gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable

docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
79645c5d4f83 gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable "/nodejs/bin/node se…" About a minute ago Up About a minute (healthy) 127.0.0.1:8076-8080/tcp gtm
f51c4737e801 gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable "/nodejs/bin/node se…" About a minute ago Up About a minute (healthy) 127.0.0.1:8075-8080/tcp gtm-vorschau

Apache2:
VirtualHost *:443
ServerName gtm.example.de
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8076/
ProxyPassReverse / http://127.0.0.1:8076/
SSLEngine On
SSLCertificateFile "/etc/ssl/example/gtm/certificate.crt"
SSLCertificateKeyFile "/etc/ssl/example/gtm/privkey.pem"
SSLCertificateChainFile "/etc/ssl/example/gtm/cert.cabundle"
/VirtualHost


VirtualHost *:443
ServerName gtmvorschau.example.de
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8075/
ProxyPassReverse / http://127.0.0.1:8075/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/example-traffic-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/example-traffic-selfsigned.key
/VirtualHost

Website (Magento 2) runs with varnish reverse proxy cache:
tcp 0 0 127.0.0.1:8075 0.0.0.0:* LISTEN 4415/docker-proxy
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 19413/redis-server
tcp 0 0 127.0.0.1:8076 0.0.0.0:* LISTEN 4521/docker-proxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 19427/varnishd
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 825/perl
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 19810/pure-ftpd (SE
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1007/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2416/exim4
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 19427/varnishd
tcp6 0 0 :::3306 :::* LISTEN 18922/mysqld
tcp6 30 0 :::49162 :::* LISTEN 1011/java
tcp6 0 0 ::1:6379 :::* LISTEN 19413/redis-server
tcp6 0 0 :::34572 :::* LISTEN 1011/java
tcp6 0 0 :::8080 :::* LISTEN 7356/apache2
tcp6 0 0 :::80 :::* LISTEN 19427/varnishd
tcp6 0 0 127.0.0.1:9200 :::* LISTEN 963/java
tcp6 0 0 :::10000 :::* LISTEN 825/perl
tcp6 0 0 :::22000 :::* LISTEN 17646/syncthing
tcp6 0 0 :::8081 :::* LISTEN 1013/node
tcp6 0 0 127.0.0.1:9300 :::* LISTEN 963/java
tcp6 0 0 :::21 :::* LISTEN 19810/pure-ftpd (SE
tcp6 0 0 :::4949 :::* LISTEN 1044/perl
tcp6 0 0 :::22 :::* LISTEN 1007/sshd
tcp6 0 0 ::1:25 :::* LISTEN 2416/exim4
tcp6 0 0 :::443 :::* LISTEN 7356/apache2
tcp6 0 0 :::8443 :::* LISTEN 1011/java
Related categories: Linux Apache Varnish Cache Docker Google Tag Management