Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
All services: admin-v2, studio-v2, website, ai-compliance-sdk, consent-service, klausur-service, voice-service, and infrastructure. Large PDFs and compiled binaries excluded via .gitignore.
97 lines
2.7 KiB
Python
97 lines
2.7 KiB
Python
"""
|
|
Jitsi Reverse Proxy
|
|
|
|
Leitet Anfragen an den internen Jitsi-Web Container weiter,
|
|
sodass Jitsi über Port 8000 erreichbar ist.
|
|
"""
|
|
|
|
import httpx
|
|
from fastapi import APIRouter, Request, Response
|
|
from fastapi.responses import StreamingResponse
|
|
import os
|
|
|
|
router = APIRouter()
|
|
|
|
JITSI_INTERNAL_URL = os.getenv("JITSI_INTERNAL_URL", "http://jitsi-web:80")
|
|
|
|
# HTTP Client mit längeren Timeouts für Streaming
|
|
client = httpx.AsyncClient(
|
|
base_url=JITSI_INTERNAL_URL,
|
|
timeout=httpx.Timeout(30.0, connect=10.0),
|
|
follow_redirects=True
|
|
)
|
|
|
|
|
|
@router.api_route("/jitsi/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD"])
|
|
async def proxy_jitsi(request: Request, path: str):
|
|
"""
|
|
Proxy all requests to Jitsi Web container.
|
|
|
|
This allows accessing Jitsi through the main backend port (8000)
|
|
instead of a separate port (8443).
|
|
"""
|
|
# Build target URL
|
|
url = f"/{path}"
|
|
if request.query_params:
|
|
url += f"?{request.query_params}"
|
|
|
|
# Forward headers (except Host)
|
|
headers = dict(request.headers)
|
|
headers.pop("host", None)
|
|
headers.pop("content-length", None)
|
|
|
|
# Get request body if present
|
|
body = await request.body() if request.method in ["POST", "PUT"] else None
|
|
|
|
try:
|
|
# Forward request to Jitsi
|
|
response = await client.request(
|
|
method=request.method,
|
|
url=url,
|
|
headers=headers,
|
|
content=body
|
|
)
|
|
|
|
# Build response headers
|
|
response_headers = dict(response.headers)
|
|
# Remove headers that shouldn't be forwarded
|
|
for header in ["content-encoding", "content-length", "transfer-encoding"]:
|
|
response_headers.pop(header, None)
|
|
|
|
return Response(
|
|
content=response.content,
|
|
status_code=response.status_code,
|
|
headers=response_headers,
|
|
media_type=response.headers.get("content-type")
|
|
)
|
|
|
|
except httpx.ConnectError:
|
|
return Response(
|
|
content="Jitsi service not available. Please start with: docker compose up -d jitsi-web",
|
|
status_code=503,
|
|
media_type="text/plain"
|
|
)
|
|
except Exception as e:
|
|
return Response(
|
|
content=f"Proxy error: {str(e)}",
|
|
status_code=502,
|
|
media_type="text/plain"
|
|
)
|
|
|
|
|
|
@router.get("/jitsi-status")
|
|
async def jitsi_status():
|
|
"""Check if Jitsi is available."""
|
|
try:
|
|
response = await client.get("/")
|
|
return {
|
|
"status": "available",
|
|
"internal_url": JITSI_INTERNAL_URL
|
|
}
|
|
except Exception as e:
|
|
return {
|
|
"status": "unavailable",
|
|
"error": str(e),
|
|
"internal_url": JITSI_INTERNAL_URL
|
|
}
|