-
Notifications
You must be signed in to change notification settings - Fork 6.2k
feat: add EdgeOne CDN geolocation headers support #3917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@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 Summary
Important Files Changed
Confidence score: 5/5
Sequence DiagramsequenceDiagram
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"
|
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". |
|
Here's an example configuration for EdgeOne 🚀 As shown in the screenshot: Rule: Your Rule's Name Headers to add:
If you use the Chinese version, the screenshot looks like this 👇 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! ✨ |
|
@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. 🚀🌍 |
mikecao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Nice


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