Skip to content

oumi-ai/test-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Proxy

A simple proxy server that adds IAP (Identity-Aware Proxy) authentication headers to requests. It forwards requests from http://localhost:8080 to a configured backend URL with the necessary Google Cloud IAP credentials.

Requirements

  • Python 3.11+
  • Google Cloud credentials configured (e.g., via gcloud auth application-default login)

Installation

pip install -e .

Usage

Run the proxy server from the src directory:

cd src
python -m test-proxy.main

The proxy will start on http://localhost:8080 and forward all incoming requests to the configured backend URL.

Environment Variables

Variable Description Required
IAP_CLIENT_ID The OAuth 2.0 client ID for the IAP-protected resource. This is critical for proxy authorization to succeed. Yes
TEST_BACKEND_URL The backend URL to forward requests to. Yes
TARGET_SERVICE_ACCOUNT The service account email to impersonate for generating IAP tokens. Yes

Example

export IAP_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export TEST_BACKEND_URL="https://your-backend-service.example.com"
export TARGET_SERVICE_ACCOUNT="your-service-account@your-project.iam.gserviceaccount.com"

python -m test-proxy.main

How It Works

  1. The proxy intercepts all HTTP requests on localhost:8080
  2. It generates an IAP bearer token by impersonating the configured service account
  3. It forwards the request to the backend URL with Authorization and Proxy-Authorization headers containing the IAP token
  4. The response from the backend is returned to the original client

About

A simple proxy used to add proxy-authorization headers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages