Skip to content

Add caddy as reverse proxy for collector to modify headers

Sebastian Rehm requested to merge bastirehm-add-collector-proxy into main

What does this MR do and why?

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/435209

Adds a reverse proxy to the collector. This allows the addition of X-Gitlab-AppId to the Allow-Response-Headers of a CORS Preflight request. Without this the header which is introduced in gl-application-sdk-browser!51 (merged) leads to a CORS error.

The header can't be configured directly in Snowplow unfortunately, so introducing a lightweight reverse proxy such as Caddy seemed like the easiest solution.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Check out gl-application-sdk-browser!51 (merged) for the Browser SDK
    1. Run yarn build in its main director
    2. Run yarn serve in the examples/vanilla-js directory
    3. Configure http://localhost:9091 as host within index.js for the vanilla js example
  2. Check out this MR
    1. Run docker compose up
  3. Check the console in http://localhost:8080 that the Snowplow events http request still make it through

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading