Gateway

Learn how to route requests to different resources

Resource format

resource gateway 'Applications.Core/gateways@2023-10-01-preview' = {
  name: 'gateway'
  properties: {
    application: app.id
    hostname: {
      // Omitting hostname properties results in gatewayname.appname.PUBLIC_HOSTNAME_OR_IP.nip.io

      // Results in prefix.appname.PUBLIC_HOSTNAME_OR_IP.nip.io
      prefix: 'prefix'
      // Alternately you can specify your own hostname that you've configured externally
      fullyQualifiedHostname: 'hostname.radapp.io'
    }
    routes: [
      {
        path: '/frontend'
        destination: 'http://${frontend.name}:3000'
      }
      {
        path: '/backend'
        destination: 'http://${backend.name}:8080'

        // Enable websocket support for the route (default: false)
        enableWebsockets: true
      }
    ]
    tls: {
      // Specify SSL Passthrough for your app (default: false)
      sslPassthrough: false

      // The Radius Secret Store holding TLS certificate data
      certificateFrom: secretstore.id
      // The minimum TLS protocol version to support. Defaults to 1.2
      minimumProtocolVersion: '1.2'
    }
  }
}

Top-level

KeyRequiredDescriptionExample
nameyThe name of your Gateway.'gateway'
locationyThe location of your resource. See common values for more information.global
propertiesyProperties of the resource.See below

Properties

KeyRequiredDescriptionExample
applicationyThe ID of the application resource this resource belongs to.app.id
hostnamenThe hostname information for this gateway.See below
routesyThe routes attached to this gateway.See below
tlsnTLS/SSL configuration for this gateway.See below

Routes

KeyRequiredDescriptionExample
pathy*The path to match the incoming request path on. Not required when tls.sslPassthrough is set to 'true'.'/service'
destinationyThe service to route traffic to, in the form '[scheme]://[serviceName]:[port]''http://backend:80'
replacePrefixnThe prefix to replace in the incoming request path that is sent to the destination route.'/'
enableWebsocketsnEnables websocket support for the route. Defaults to false.true
timeoutPolicynThe timeout policy for the route.See below
Timeout Policy
KeyRequiredDescriptionExample
requestnThe timeout for the request in seconds. Defaults to 15 seconds.30s
backendRequestnThe timeout for the backend request in seconds. Defaults to 15 seconds.30s

Hostname

You can define hostname information for how to access your application. See below for more information.

KeyRequiredDescriptionExample
prefixnA custom DNS prefix for the generated hostname.'prefix'
fullyQualifiedHostnamenA fully-qualified domain name to use for the gateway.'myapp.mydomain.com'

TLS

KeyRequiredDescriptionExample
sslPassthroughnConfigures the gateway to passthrough encrypted SSL traffic to an HTTP route and container. Requires a single route to be set with no ‘path’ defined (just destination). With sslPassthrough set to true, the gateway can only support SNI routing. Path based routing cannot be supported. Defaults to ‘false’.true
hostnamenThe hostname for TLS termination.'hostname.radapp.io'
certificateFromnThe Radius Secret Store resource ID that holds the TLS certificate data for TLS termination.secretstore.id
minimumProtocolVersionnThe minimum TLS protocol to support for TLS termination.'1.2'

Note that SSL passthrough and TLS termination functionality are mutually exclusive.

Hostname Generation

There are three options for defining hostnames:

  1. Omit the hostname property, and Radius will generate the hostname for you with the format: gatewayname.appname.PUBLIC_HOSTNAME_OR_IP.nip.io.
  2. Declare hostname.prefix, and Radius will generate the hostname based on your chosen prefix: prefix.appname.PUBLIC_HOSTNAME_OR_IP.nip.io.
  3. Declare hostname.fullyQualifiedHostname, and Radius will use your fully-qualified domain name as the hostname: myapp.mydomain.com. Note that you must map the public IP of the platform your app is running on to the chosen hostname. If you provide this property as well as prefix, this property will take precedence.