GTM Server-Side Tracking Setup is not working using local VirtualHost with docker

I am testing the GTM server side installation inside my Windows powered docker. I will explain all the steps I am doing and please do correct me what I am doing wrong.

1: I am creating two domain-subdomain in my WAMP Apache server using below code (which works fine)

<VirtualHost *:80>
    ServerName ssgtm{.}dev
    RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule ^ {HTTP_HOST}%{REQUEST_URI}

<VirtualHost *:80>
    ServerName preview .ssgtm .dev
    RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule ^ %{HTTP_HOST}%{REQUEST_URI}

2: And these for proxying and SSL

<VirtualHost _default_:443>
    ServerName ssgtm{.}dev:443

    ProxyPreserveHost On
    ProxyRequests Off

    ProxyPass / localhost{:}8080/
    ProxyPassReverse / localhost{:}8080/

    SSLEngine on
    SSLCertificateFile "C:/ssls/ssgtm{.}dev{.}crt"
    SSLCertificateKeyFile "C:/ssls/ssgtm{.}dev {.}key"

<VirtualHost _default_:443>
    ServerName preview{.}ssgtm{.}dev:443

    ProxyPreserveHost On
    ProxyRequests Off

    ProxyPass / localhost{:}8079/
    ProxyPassReverse / localhost{:}8079/

    SSLEngine on
    SSLCertificateFile "C:/ssls/preview{.}ssgtm{.}dev{.}crt"
    SSLCertificateKeyFile "C:/ssls/preview{.}ssgtm{.}dev{.}key"

And now setting docker container:

docker run -d --name gtm-preview -p 8079:8079 -e CONTAINER_CONFIG=aWQ -e RUN_AS_PREVIEW_SERVER=true -e PORT=8079 gcr{.}io/cloud-tagging-10302018/gtm-cloud-image:stable

docker run -d --name gtm-live -p 8080:8080 -e CONTAINER_CONFIG=aWQ -e PREVIEW_SERVER_URL=preview{.}ssgtm{.}dev -e PORT=8080 gcr{.}io/cloud-tagging-10302018/gtm-cloud-image:stable

At this point everything works fine… I can visit both sites and check the /healthz printing ok…



I have added the domain in GTM settings too… i{.}stack{.}imgur{.}com/Jp7EE{.}png

When now I go to check the tracking : ssgtm{.}dev/?test=ok and ssgtm{.}dev/gtm/debug?id=GTM-000000&gtm_auth=000000&gtm_preview=env-3 It prints below error in the debug console :

An exception was thrown while proxying preview request. Make sure the PREVIEW_SERVER_URL is set correctly and the preview server is healthy. Message: connect ECONNREFUSED

What I am thinking is that the tagging server is not able to connect with the preview server? or it is because of the custom virtual domain in my apache local? Any help would be appreciated. Thanks

PS : I had to put {.} instead of . in domain name and removed https:// as the system is not letting me add links more than 2 and i have many!!

Hi, did you solve problem?

Hi, with

<VirtualHost *:443>
ServerName gaserver-xxxxx-eu
DocumentRoot /var/www/html
ProxyPreserveHost On
ProxyPass / http://127-0-0-1-:8090/
ProxyPassReverse / http://127-.0-.0.-1-:8090/
SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
Include /etc/letsencrypt/options-ssl-apache.conf


docker run -p 8090:8080 -e CONTAINER_CONFIG=‘aWQ9…’ -e RUN_AS_PREVIEW_SERVER=true Google Cloud console

on the server


returns ok and also
returns ok
But /g/collect requests that I see in tagassistant return a NOT FOUND
As /g/collect is the default I expected it to be served by the docker GTM server instance
Any ideas?
PS As a new user I may only use 2 links :wink:

Apparently the problem was linked to preview mode.
In production the Postman request is correctly sent to GA via our Apache and GTM docker instance
I can’t show you the Postman log because of the 2 links :frowning:|Not%253BA%253DBrand%3B8.0.0.0|Chromium%3B117.0.5938.149&uamb=0&uam=&uap=macOS&uapv=13.5.2&uaw=0&are=1&_s=1&sid=1697116746&sct=2&seg=1&