Routes

CGI Routes

The /em-cgi/* routes are a set of developer utilities that return various useful datasets and offer some operational shortcuts.


Version

Responds with the current version and deployment track of the Edgemesh® Server instance running on the site.

GET
https://example.com/em-cgi/utils/version

Response Properties


The version of Edgemesh® Server running this site.

track
string stable | canary | nightly
The deployment track this site is running on.
Version Route
https://example.com/em-cgi/utils/version
Example Response
1{
2 "version": "2.0.0",
3 "track": "stable"
4}

Configuration

Responds with the current configuration running on the site.

GET
https://example.com/em-cgi/utils/config

Response Properties


cdnTrack
string (stable | canary | nightly)
The deployment track for Edgemesh® Client and other static resources.
  • stable: Production track. All customers run on this track unless a new feature is being tested on a customer's behalf.
  • canary: This track is for testing features that are stable and ready to be promoted to production. Customers can set their staging sites to this track in order to run integration tests with new features.
  • nightly: This track is used to test potentially unstable new features. Customer's production sites are never set to this track. Only staging sites are eligible for this track.

apiTrack
string (stable | canary | nightly)
The deployment track for Edgemesh® API.
  • stable: Production track. All customers run on this track unless a new feature is being tested on a customer's behalf.
  • canary: This track is for testing features that are stable and ready to be promoted to production. Customers can set their staging sites to this track in order to run integration tests with new features.
  • nightly: This track is used to test potentially unstable new features. Customer's production sites are never set to this track. Only staging sites are eligible for this track.

workerTrack
string (stable | canary | nightly)
The deployment track for Edgemesh® Server.
  • stable: Production track. All customers run on this track unless a new feature is being tested on a customer's behalf.
  • canary: This track is for testing features that are stable and ready to be promoted to production. Customers can set their staging sites to this track in order to run integration tests with new features.
  • nightly: This track is used to test potentially unstable new features. Customer's production sites are never set to this track. Only staging sites are eligible for this track.

Edge caching enabled.

The cache revalidation time in seconds. Pages will be continuously revalidated, but other resources are revalidated on an interval.

When no cache control header is present on a resource, Edgemesh® sets a default header. This value is the s-maxage, or the time the resource will be cached at the edge.

Enables the tag-less tracking and analytics data collection.

Dynamic pre-rendering enabled. Bots and search engines will be served a pre-rendered version of the page. Pre-rendered pages are faster and better for indexing, but lack interactivity.

Enables the image optimization feature.

The default quality for image optimization. This value can be overridden for a specific image via the em-quality search parameter. The default of 75 is a good balance between clarity and performance.

Enables ad fraud and bot traffic protection.

Un-shard image src and srcset attributes.

unshardCss
boolean
Un-shard stylesheet href attributes and stylesheet content

Un-shard script tag src attributes.

minifyHtml
boolean
Minifies HTML content and strips comments.

minifyCss
boolean
Minifies stylesheet content and strips comments.

Minifies javascript content and strips comments.

Inject the Edgemesh® Client script.

Enables the Shopify plugin.
Config Route
https://example.com/em-cgi/utils/config
Example Response
1{
2 "apiTrack": "stable",
3 "cdnTrack": "stable",
4 "workerTrack": "stable",
5 "enableCaching": true,
6 "revalidateTime": 900,
7 "defaultMaxAge": 604800,
8 "enableAnalytics": true,
9 "enablePrerender": true,
10 "enableImageOptimization": true,
11 "defaultImageQuality": 75,
12 "enableBotProtection": true,
13 "unshardImages": true,
14 "unshardCss": true,
15 "unshardScripts": true,
16 "minifyHtml": true,
17 "minifyCss": true,
18 "minifyScripts": true,
19 "injectClient": true,
20 "shopifyPlugin": true
21}

Geographic

Responds with the geo-location data for the requesting client.

GET
https://example.com/em-cgi/utils/geo

Response Properties


ip
string
The IPv6 or IPv4 address of the requesting client.

asn
string
The autonomous system number of the requesting client's network.

The name of the requesting client's network.

colo
string
The three-letter IATA airport code of the data center that the request hit.

city
string
The city of the requesting client.

region
string
If known, the ISO 3166-2 name for the first level region associated with the IP address of the requesting client.

If known, the ISO 3166-2 code for the first-level region associated with the IP address of the requesting client.

The postal code of the requesting client.

metroCode
string
The metro code (DMA) of the requesting client.

country
string
The two-letter country code of the requesting client.

continent
string
The continent code of the requesting client.

Whether or not the requesting client is in an EU Country.

latitude
string
The approximate latitude of the requesting client.

longitude
string
The approximate longitude of the requesting client.

timezone
string
The timezone of the requesting client.
Geo Route
https://example.com/em-cgi/utils/geo
Example Response
1{
2 "ip": "6366:ae89:c273:9670:6260:9306:d57d:9416",
3 "asn": 16591,
4 "organization": "Google Fiber",
5 "colo": "LAX",
6 "city": "Irvine",
7 "region": "California",
8 "regionCode": "CA",
9 "postalCode": "92612",
10 "metroCode": "803",
11 "country": "US",
12 "continent": "NA",
13 "isEUCountry": false,
14 "latitude": 33.6564,
15 "longitude": -117.8245,
16 "timezone": "America/Los_Angeles"
17}

Bot Score

Responds with the bot score for the requesting client.

GET
https://example.com/em-cgi/utils/bot

Response Properties


isBot
boolean
Whether or not the requesting client was determined to be a bot.

isCrawler
boolean
Whether or not the requesting client was determined to be a crawler.

If the requesting client was determined to be a major verified crawler, this value will be the platform of the crawler.

NONE: Requesting client was not determined to be a crawler.

GOOGLE: Requesting client was determined to belong to Google.

APPLE: Requesting client was determined to belong to Apple.

MICROSOFT: Requesting client was determined to belong to Microsoft.

YANDEX: Requesting client was determined to belong to Yandex.

YAHOO: Requesting client was determined to belong to Yahoo.

BAIDU: Requesting client was determined to belong to Baidu.

DUCK_DUCK: Requesting client was determined to belong to Duck Duck Go.

FACEBOOK: Requesting client was determined to belong to Facebook.

TWITTER: Requesting client was determined to belong to Twitter.

LINKEDIN: Requesting client was determined to belong to LinkedIn.

OTHER: Requesting client was determined to belong to a platform we do not currently track. Check the User Agent for more info. If you would like to see a crawler agent added to the list, create a feature request.


If the client is a bot, this field will be true if the bot is verified and trusted.
Bot Score Route
https://example.com/em-cgi/utils/bot
Example Response
1{
2 "isBot": false,
3 "isCrawler": false,
4 "crawlerPlatform": "NONE",
5 "verifiedBot": false
6}

Cache Proxy

This route allows a savvy developer to cache any arbitrary response. The request method does not matter. This allows you to easily cache applicable API responses easily, effectively speeding up a slow origin from a third or first party. Just make sure that whatever you are caching is not personalized or dynamic.

GET
https://example.com/em-cgi/cache/{{ttl}}/{{url}}

Request Parameters


ttl
number
REQUIRED
Cache time to live in seconds. This tells Edgemesh® Server how long to cache your response.

url
string
REQUIRED
The URL to cache with the protocol omitted (SSL is required on the requested content).
Cache Proxy Route
https://example.com/em-cgi/cache/86400/swapi.dev/api/starships

Dynamic Content

This route extracts all dynamic content from the given pathname and returns a positionally accurate array of said content. This content is automatically requested and injected client side by javascript added by Edgemesh® Server, but this is also a good way to verify that the content you expect to be dynamic is in-fact changing the way you expect, without having to search through the elements inspector.

GET
https://example.com/em-cgi/dynamic/{{pathname}}

Request Parameters


pathname
string
The pathname to return dynamic content for defaulting to /.
Dynamic Content Route (Homepage)
https://example.com/em-cgi/dynamic
Dynamic Content Route (Pathname)
https://example.com/em-cgi/dynamic/collections/all
Example Response
1[
2 "Hello, John Doe!",
3 "You currently have 1024 loyalty points!"
4]

Purge Cache

Visiting this route will clear the Edgemesh® related Cache API caches for the requesting client's browser. This is useful for operational customer support when you may want a customer to clear their browser cache. With this route, you can just send a link to your customer rather than walking them through clearing their cache on their specific device.

GET
https://example.com/em-cgi/purge/cache?redirect={url}

Search Parameters


redirect
string
A URL to redirect to after the purge operation is completed. Defaults to the home page.
Purge Cache Route
https://example.com/em-cgi/purge/cache?redirect=/pages/success

Purge Cookies

Visiting this route will clear the cookies for the requesting client's browser. This is useful for operational customer support when you may want a customer to clear their cookies. With this route, you can just send a link to your customer rather than walking them through clearing their cookies on their specific device.

GET
https://example.com/em-cgi/purge/cookies?redirect={url}

Search Parameters


redirect
string
A URL to redirect to after the purge operation is completed. Defaults to the home page.
Purge Cookies Route
https://example.com/em-cgi/purge/cookies?redirect=/pages/success

Purge Local Storage

Visiting this route will clear the local storage for the requesting client's browser. This is useful for operational customer support when you may want a customer to clear their local storage. With this route, you can just send a link to your customer rather than walking them through clearing their local storage on their specific device.

GET
https://example.com/em-cgi/purge/local-storage?redirect={url}

Search Parameters


redirect
string
A URL to redirect to after the purge operation is completed. Defaults to the home page.
Purge Local Storage Route
https://example.com/em-cgi/purge/local-storage?redirect=/pages/success

Purge Indexed DB

Visiting this route will clear the Edgemesh® related Indexed DB stores for the requesting client's browser. This is useful for operational customer support when you may want a customer to clear their Indexed DB. With this route, you can just send a link to your customer rather than walking them through clearing their Indexed DB storage on their specific device.

GET
https://example.com/em-cgi/purge/indexed-db?redirect={url}

Search Parameters


redirect
string
A URL to redirect to after the purge operation is completed. Defaults to the home page.
Purge Indexed DB Route
https://example.com/em-cgi/purge/indexed-db?redirect=/pages/success

Purge Service Worker

Visiting this route will unregister the service worker on the requesting client's browser. This is useful for operational customer support when you may want a customer to unregister their service worker. With this route, you can just send a link to your customer rather than walking them through unregistering the service worker on their specific device.

GET
https://example.com/em-cgi/purge/service-worker?redirect={url}

Search Parameters


redirect
string
A URL to redirect to after the purge operation is completed. Defaults to the home page.
Purge Service Worker Route
https://example.com/em-cgi/purge/service-worker?redirect=/pages/success

Purge All

Visiting this route will perform all the aforementioned purges in one step (cache, cookies, local storage, indexed db, and service worker). This is useful for operational customer support when you may want a customer to reset all of their browser's storage. With this route, you can just send a link to your customer rather than walking them through resetting storage on their specific device.

GET
https://example.com/em-cgi/purge/all?redirect={url}

Search Parameters


redirect
string
A URL to redirect to after the purge operation is completed. Defaults to the home page.
Purge All Route
https://example.com/em-cgi/purge/all?redirect=/pages/success

Made withby Edgemesh Corporation