Routes
When you create an Edge Computing application, a subdomain of arvanedge.ir is assigned to it by default. With routes, you can send the traffic and requests of a specific URL of a domain that is active on the Arvancloud CDN to your Edge Computing application.
Defining a Route
After clicking the Edge Computing application you want, click the New Route button in the routes section.
In the sidebar, select your domain and then enter the path you want to connect to the Edge Computing application.
For example, you can enter /app/* so that requests sent to this path are answered by the Edge Computing application.
To define this route using the API, you can use the following example:
curl --location 'https://napi.arvancloud.ir/edge-computing/1.0/edge-computes/{workers.ID}/routes' \
--header 'authorization: API KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain, */*' \
--data '{"domain":"myexampledomain.ir.ir","url":"/app/*","status":"active"}'
After you define a new route, a page rule is created for your domain to apply these settings.
Apart from the default route, which is defined to send traffic to the arvanedge.ir subdomain, you can enable or disable other routes, edit them, or delete them when needed.
To enable or disable a route using the API, you can use the following example:
curl --location --request PUT 'https://napi.arvancloud.ir/edge-computing/1.0/edge-computes/{workers.ID}/routes//{routes.ID}' \
--header 'authorization: API KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain, */*' \
--data '{"url":"/app/*","status":"inactive"}
In this request, the
statusparameter accepts two values:activeto enable the route orinactiveto disable it.