Skip to content

Conversation

@Mintimate
Copy link
Contributor

After feedback to Tencent Cloud EdgeOne team, the feature is now available:

  • Add support for EdgeOne CDN geolocation headers (eo-ipcountry, eo-region-code, eo-ipcity)
  • Align EdgeOne with existing CDN providers (Cloudflare, Vercel, CloudFront)
  • Requires custom request headers configuration in EdgeOne Rule Priorities

@vercel
Copy link

vercel bot commented Dec 22, 2025

@Mintimate is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 22, 2025

Greptile Summary

  • Adds support for Tencent Cloud EdgeOne CDN geolocation headers (eo-ipcountry, eo-region-code, eo-ipcity) to enable automatic location detection for users behind EdgeOne CDN
  • Extends the PROVIDER_HEADERS array in src/lib/detect.ts following the same architectural pattern used by existing CDN providers (Cloudflare, Vercel, CloudFront)
  • Implementation includes proper documentation linking to EdgeOne configuration requirements and maintains backward compatibility with existing geolocation detection functionality

Important Files Changed

Filename Overview
src/lib/detect.ts Added EdgeOne provider entry to PROVIDER_HEADERS array with CDN-specific geolocation headers

Confidence score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects simple, well-documented changes that follow existing patterns and maintain backward compatibility
  • No files require special attention

Sequence Diagram

sequenceDiagram
    participant User
    participant EdgeOne as "EdgeOne CDN"
    participant App as "Umami App"
    participant Detect as "detect.ts"
    participant MaxMind as "MaxMind DB"

    User->>EdgeOne: "HTTP Request"
    EdgeOne->>App: "Request with EdgeOne headers (eo-ipcountry, eo-region-code, eo-ipcity)"
    App->>Detect: "getClientInfo(request, payload)"
    Detect->>Detect: "getLocation(ip, headers, hasPayloadIP)"
    Detect->>Detect: "Check PROVIDER_HEADERS array"
    Detect->>Detect: "Find EdgeOne headers"
    Detect->>Detect: "decodeHeader() for country/region/city"
    Detect->>Detect: "getRegionCode(country, region)"
    Detect->>App: "Return location data {country, region, city}"
    App->>User: "Response with geolocation analytics"
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 22, 2025

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@Mintimate Mintimate changed the base branch from master to dev December 22, 2025 11:42
@Mintimate
Copy link
Contributor Author

Here's an example configuration for EdgeOne 🚀 As shown in the screenshot:

Demo Of EdgeOne's Console

Rule: Your Rule's Name
Condition: URL path matches regex ^/api
Action: Add custom request headers

Headers to add:

  • eo-ipcountry: ${http.request.ip.country}
  • eo-region-code: ${http.request.ip.region_code}
  • eo-region-name: ${http.request.ip.region_name}
  • eo-ipcity: ${http.request.ip.city}

If you use the Chinese version, the screenshot looks like this 👇

Demo Of Chinese EdgeOne's Console

As for Nginx reverse proxy configuration 🔧

location / {
    # Disable proxy buffering for real-time streaming
    proxy_buffering off;

    # Use HTTP/1.1 for upstream connections (required for keep-alive)
    proxy_http_version 1.1;

    # Forward original client information to upstream
    proxy_ssl_session_reuse off;
    proxy_ssl_server_name on;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host  $host;

    # Pass EdgeOne geo-location headers to upstream
    proxy_set_header eo-ipcountry $http_eo_ipcountry;
    proxy_set_header eo-region-code $http_eo_region_code;
    proxy_set_header eo-region-name $http_eo_region_name;
    proxy_set_header eo-ipcity $http_eo_ipcity;

    # Proxy to Umami analytics backend
    proxy_pass http://127.0.0.1:3000;
}

Hope this helps! ✨

@Mintimate Mintimate changed the title feat: add EdgeOne geolocation headers support feat: add EdgeOne CDN geolocation headers support Dec 30, 2025
@Mintimate
Copy link
Contributor Author

@mikecao @franciscao633 Hey guys, I think this merge is quite useful. EdgeOne is gaining more popularity now (though its scale isn't yet comparable to CDNs like Cloudflare 😂). Using their request headers to get IP geolocation is very convenient, and it avoids the difficulties of downloading Geo IP databases in Mainland China during the build process. 🚀🌍

Copy link
Collaborator

@mikecao mikecao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice

@mikecao mikecao merged commit e90b220 into umami-software:dev Jan 7, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants