Platform.sh is now Upsun. Click here to learn more
Upsun Fixed User Documentation

additional_hosts

Try Upsun for 15 days
After that, enjoy the same game-changing Upsun features for less with the First Project Incentive!¹ A monthly $19 perk!
Activate your 15-day trial
¹Terms and conditions apply. Only for Flexible Resource projects.

An additional hosts dictionary that maps hostnames to IP addresses.

Optional in single-runtime and composable images.

If you use a private network and have specific IP addresses to connect to, consider mapping those addresses to hostnames to better remember and organize them. In such cases, you can add a map of those IP addresses to hostnames of your choice. Then, when your app tries to access the hostname, the app is directed to the proper IP address.

For example, if your app attempts to access api.example.com, it is directed to 192.0.2.23.

.platform.app.yaml
applications:
  APP_NAME:
    type: 'nodejs:24'
    source:
      root: "/"
    additional_hosts:
      api.example.com: "192.0.2.23"
      web.example.com: "203.0.113.42"
.platform.app.yaml
applications:
  APP_NAME:
    type: "composable:25.05"
    source:
      root: "/"
    stack: 
      runtimes: [ "nodejs@24" ]
    additional_hosts:
      api.example.com: "192.0.2.23"
      web.example.com: "203.0.113.42"

This is equivalent to adding the mapping to the /etc/hosts file for the container.