Skip to content

Instantly share code, notes, and snippets.

@x1unix
Last active October 11, 2024 06:47
Show Gist options
  • Save x1unix/be7e15dbe91b4e63658346c62cefd19a to your computer and use it in GitHub Desktop.
Save x1unix/be7e15dbe91b4e63658346c62cefd19a to your computer and use it in GitHub Desktop.
Jaeger + CORS Proxy
services:
nginx:
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "16686:16686" # Both Jaeger UI and exporter are on the same port.
depends_on:
- jaeger
jaeger:
image: jaegertracing/all-in-one:1.62.0
environment:
COLLECTOR_ZIPKIN_HTTP_PORT: 9411
expose:
- "16686" # Jaeger UI
- "4318" # HTTP collector
events {}
error_log /dev/stderr error;
http {
server {
listen 16686;
# Jaeger UI
location / {
proxy_pass http://jaeger:16686;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
if ($request_method = OPTIONS) {
return 204;
}
}
# Jaeger HTTP Collector
location /v1/traces {
proxy_pass http://jaeger:4318/v1/traces;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
if ($request_method = OPTIONS) {
return 204;
}
}
# Jaeger gRPC Collector
location /grpc {
proxy_pass http://jaeger:14250;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
if ($request_method = OPTIONS) {
return 204;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment