# CMS API routes - redirect to CMS service (port 3001)
# This file is included at the server level for studio.norteamericano.com

# Handle CMS API routes before the main location block
location ~ ^/(auth|courses|modules|lessons|assets|organization|branding|users|admin|question-bank|test-templates|knowledge-base|api|webhooks|grading|libraries|rubrics|learning-sequences|audit-logs|analytics|cohorts|announcements|submissions|peer-reviews|instructors|token-usage|sam|embeddings|health) {
    proxy_pass http://172.18.0.6:3001;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $origin_proto;
    proxy_set_header X-Forwarded-Ssl on;
    proxy_set_header Connection "";
    proxy_http_version 1.1;
}
