Skip to content

Using FLAGSMITH_API_PROXY_URL prevents the FE from reading the API /version endpoint #6588

@matthewelwell

Description

@matthewelwell

How are you running Flagsmith

  • Self Hosted with Docker
  • Self Hosted with Kubernetes
  • SaaS at flagsmith.com
  • Some other way (add details in description below)

Describe the bug

When using the FE to proxy traffic to the API via the FLAGSMITH_API_PROXY_URL environment variable, the FE is unable to access the /version endpoint on the API because it only proxies traffic where the URI starts with /api/v1.

Note that this prevents the FE from determining if the running API is the enterprise version or not since the FE just responds with it's own /version endpoint and doesn't proxy to the API.

Steps To Reproduce

The following is a minimal docker-compose to reproduce the issue. Note that this is also the default behaviour in k8s.

volumes:
  pgdata:

services:
  postgres:
    image: postgres:15.5-alpine
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_DB: flagsmith
    container_name: flagsmith_postgres
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -d flagsmith -U postgres']
      interval: 2s
      timeout: 2s
      retries: 20
      start_period: 20s

  flagsmith-frontend:
    image: flagsmith/flagsmith-frontend:latest
    environment:
      FLAGSMITH_PROXY_API_URL: http://flagsmith-api:8000
    ports:
      - 8080:8080

  flagsmith-api:
    image: docker.flagsmith.com/flagsmith/flagsmith-api:latest
    environment:
      DATABASE_URL: postgresql://postgres:password@postgres:5432/flagsmith
      DJANGO_ALLOWED_HOSTS: '*'
      DJANGO_SECRET_KEY: secret
      TASK_RUN_METHOD: TASK_PROCESSOR
    depends_on:
      postgres:
        condition: service_healthy

  flagsmith-task-processor:
    image: docker.flagsmith.com/flagsmith/flagsmith:latest
    environment:
      DATABASE_URL: postgresql://postgres:password@postgres:5432/flagsmith
      DJANGO_ALLOWED_HOSTS: '*'
    ports:
      - 8001:8000
    depends_on:
      - flagsmith-api
    command: run-task-processor

Expected behavior

The FE can access the /version endpoint of the API.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions