HAALCENTRAAL BRP Reisdocumenten
Haal Centraal / BRP Reisdocumenten / Reisdocumenten bevragen Proxy Configuration

Reisdocumenten bevragen Proxy Configuration

The following settings of the Reisdocumenten bevragen Proxy can be adjusted:

Routing

By default the Reisdocumenten bevragen Proxy is configured to forward queries to the mock of the Reisdocumenten bevragen Web API GBA variant.

The Downstream configuration of the Reisdocumenten bevragen Proxy must be adjusted to forward queries to another instance of the Reisdocumenten bevragen Web API GBA variant.

Changing the Downstream configuration of the Proxy (Docker Compose variant)

The following environment variables must be included in the configuration of the Proxy in the docker compose file:

In the following example the Proxy is configured to forward queries to the pilot environment of the Reisdocumenten bevragen Web API GBA variant:

  reisdocumentproxy:
    container_name: reisdocumentproxy
    image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
    environment:
      - ASPNETCORE_ENVIRONMENT=Release
      - ASPNETCORE_URLS=http://+:5000
      - Routes__0__DownstreamScheme=https
      - Routes__0__DownstreamHostAndPorts__0__Host=proefomgeving-gba.haalcentraal.nl
      - Routes__0__DownstreamHostAndPorts__0__Port=443
    ports:
      - "5002:5000"
    networks:
      - reisdocumenten-api-network

Another possibility is to define the routing configuration in a JSON file and mount it to a container instance using a volume mount.

In the following example the configuration of the routing to the pilot environment of the Reisdocumenten bevragen Web API GBA variant is specified. This configuration file can also be found in the Reisdocumenten bevragen GitHub repository.

{
  "Routes": [
    {
      "UpstreamPathTemplate": "/haalcentraal/api/reisdocumenten/reisdocumenten",
      "DownstreamPathTemplate": "/haalcentraal/api/reisdocumenten/reisdocumenten",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "proefomgeving-gba.haalcentraal.nl",
          "Port": "443"
        }
      ]
    }
  ]
}

The configuration file is then mounted to a Reisdocumenten bevragen Proxy instance using a volume mount. In the example below, the ocelot.json file in the src/config/ReisdocumentProxy/configuration folder is mounted to a Reisdocumenten bevragen Proxy instance.

  reisdocumentproxy:
    container_name: reisdocumentproxy
    image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
    environment:
      - ASPNETCORE_ENVIRONMENT=Release
      - ASPNETCORE_URLS=http://+:5000
    ports:
      - "5002:5000"
    volumes:
      - ./src/config/ReisdocumentProxy/configuration/ocelot.json:/app/configuration/ocelot.json
    networks:
      - reisdocumenten-api-network

Changing the Downstream configuration of the Proxy (Kubernetes variant)

The following environment variables must be included in the configuration of the Proxy in the reisdocument proxy deployment file:

In the following example the Proxy is configured to forward queries to the pilot environment of the Reisdocumenten bevragen Web API GBA variant:

      containers:
        - name: reisdocumentproxy
          image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
          env:
            - name: ASPNETCORE_ENVIRONMENT
              value: Release
            - name: ASPNETCORE_URLS
              value: http://+:5000
            - name: Routes__0__DownstreamScheme
              value: https
            - name: Routes__0__DownstreamHostAndPorts__0__Host
              value: proefomgeving-gba.haalcentraal.nl
            - name: Routes__0__DownstreamHostAndPorts__0__Port
              value: "443"
          ports:
            - name: http-reisdocumentproxy
              containerPort: 5000

Another possibility is to define the routing configuration in a JSON file and mount it to a container instance using a volume mount.

Logging

Log level

By default the BRP Reisdocumenten Proxy is configured with Log level Warning. At this log level only invalid queries (queries that result in a 4XX and 5XX HTTP status response) are logged.

To log all queries, the Log level must be set to Information. The Log level is set using the Serilog__MinimumLevel__Override__Serilog environment variable.

In the following examples the Log level is set to Information.

Docker Compose variant:

reisdocumentproxy:
  container_name: reisdocumentproxy
  image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
  environment:
    - ASPNETCORE_ENVIRONMENT=Release
    - ASPNETCORE_URLS=http://+:5000
    - Serilog__MinimumLevel__Override__Serilog=Information
  ports:
    - "5002:5000"
  networks:
    - reisdocumenten-api-network

Kubernetes variant:

containers:
  - name: reisdocumentproxy
    image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
    env:
      - name: ASPNETCORE_ENVIRONMENT
        value: Release
      - name: ASPNETCORE_URLS
        value: http://+:5000
      - name: Serilog__MinimumLevel__Override__Serilog
        value: Information
    ports:
      - name: http-reisdocumentproxy
        containerPort: 5000

Log providers

The BRP Reisdocumenten Proxy can write log entries to the following log providers:

Console log provider

By default, logging to which log providers is taking place is logged to the console (in Docker Desktop the Logs tab of the container).

For debugging purposes it is possible to have requests logged to the console. For this the value of the Serilog__MinimumLevel__Override__Serilog environment variable must be set to Debug. Because logging to the console can have an impact on performance, it is not recommended to use console logging in production.

Seq

To log to a Seq server, the URL of the Seq server must be specified using the Seq__ServerUrl environment variable.

reisdocumentproxy:
  container_name: reisdocumentproxy
  image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
  environment:
    - ASPNETCORE_ENVIRONMENT=Release
    - ASPNETCORE_URLS=http://+:5000
    - Seq__ServerUrl=http://seq:5341
  ports:
    - "5002:5000"
  networks:
    - reisdocumenten-api-network

File in Elasticsearch Common Schema (ECS) format

To log to a file, the full path of the log file must be specified using the Ecs__Path environment variable. The log entries are written to the file in Elasticsearch Common Schema (ECS) format.

reisdocumentproxy:
  container_name: reisdocumentproxy
  image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
  environment:
    - ASPNETCORE_ENVIRONMENT=Release
    - ASPNETCORE_URLS=http://+:5000
    - Ecs__Path=/var/log/api/reisdocumentproxy.txt
  ports:
    - "5002:5000"
  networks:
    - reisdocumenten-api-network

mTLS

To have the communication between the BRP Reisdocumenten Proxy and an API gateway or the BRP Reisdocumenten Web API GBA variant at RvIG take place over mTLS, the following environment variables must be set for the BRP Reisdocumenten Proxy:

The folder where the client certificate is located must also be mounted at /app/certificates using a volume mount. In the example below, the client certificate settings have been added to the Proxy configuration.

reisdocumentproxy:
  container_name: reisdocumentproxy
  image: ghcr.io/brp-api/haal-centraal-reisdocument-bevragen-proxy:latest
  environment:
    - ASPNETCORE_ENVIRONMENT=Release
    - ASPNETCORE_URLS=http://+:5000
    - Serilog__MinimumLevel__Override__Serilog=Information
    - ClientCertificate__Name=xxx
    - ClientCertificate__Password=yyy
  ports:
    - "5002:5000"
  volumes:
    - <path to client certificate folder>:/app/certificates
  networks:
    - reisdocumenten-api-network