In App Platform, a service is a type of resource that is accessible via public or internal ports, and running server-side code written in a supported programming language, such as Python, Ruby, Go, Node.js, or PHP. Because services are accessible, they need to be configured with HTTP port and HTTP route values, so that the load-balancer can distribute traffic properly or define internal ports which are only accessible by other resource such as workers or other services within the app.
Other than being accessible, a service has the same properties as a worker, which can not accept HTTP requests and is for doing background tasks.
0.0.0.0, rather than on the localhost (
localhost) or loopback interface (
If your backend service requires the full HTTP request path preserved, set the
preserve_path_prefix annotation to
true in the App Spec.
In microservice architectures, it is common to have services that should not be publicly exposed. These are called internal services, and they are not mutually exclusive from internet accessible services. A service can support both internal ports and publicly accessible ports, or a service can be one or the other.
There is no prescriptive way to define a service as “Internal” in App Platform. Instead, internal services are implicitly defined within the App spec by picking one or more internal ports that will be exposed to the service. A truly internal service will have neither a HTTP route nor HTTP port, only exposing internal ports making it only accesible by other resources within the App.