Web Server Configuration


App Platform automatically configures the web server when you create an application. If needed, you can adjust how requests and responses are handled: set up redirects, configure HTTP headers, or enable data compression.

The available settings depend on the type of application. For frontend applications, you can also configure how missing paths are handled. For backend and Docker applications, you can limit the request body size and set a timeout for response headers.

Web server settings apply to all domains linked to the application.

Changing Web Server Settings
Copy link

To change the web server settings:

  1. Go to the App Platform section and select the application you want to configure.

  2. Open the Settings tab.

  3. Next to Web Server Settings, click Configure.

  4. Specify the parameters you need.

  5. Click Save.

Saving these settings triggers a new deployment of the application.

General Settings
Copy link

Redirects, HTTP headers, and compression are available for all application types.

Redirects
Copy link

Redirects let you forward requests from one path or domain to another. You can add up to 10 redirects per application.

To configure a redirect, specify:

  • Type: path or host
  • Source: The original path or domain
  • Destination: The target path or domain
  • Code: The response code. Available values are:
    • 301: Permanent redirect
    • 302: Temporary redirect
    • 307: Temporary redirect that preserves the request method and body
    • 308: Permanent redirect that preserves the request method and body

Path-based redirects

For a path-based redirect, select the path type. Both Source and Destination must start with /, for example, /old and /new.

Keep the following restrictions in mind:

  • The source and target paths must be different
  • Paths can't include query parameters (after ?) or fragments (after #)
  • Query parameters from the original request are preserved after the redirect

For example, redirecting /old to /new means a request to /old?source=mail will be redirected to /new?source=mail.

Host-based redirects

For a host-based redirect, select the host type. You can only choose source and target domains from those already linked to the application.

Headers
Copy link

You can add, replace, or remove HTTP headers in the web server's responses. You can configure up to 10 rules per application.

For each header, choose a type:

  • set: Assign a new value to a header or replace its existing value
  • add: Add another value for the header
  • delete: Remove the header from the response

For the set and add types, specify both the header name and value. For delete, specify only the name.

For a single header name, you can't:

  • Create more than one set rule
  • Combine different types, for example, set with add, or add with delete

Multiple add rules for the same header are allowed.

Compression
Copy link

Compression reduces the amount of data the web server sends to the client, which can speed up how quickly your application loads.

To enable compression, choose one or more algorithms:

  • gzip
  • zstd

Frontend App Settings
Copy link

Frontend applications have an additional setting called SPA Fallback.

SPA Fallback
Copy link

SPA Fallback determines what file the application returns when a request is made to a path that doesn't exist.

If this option is enabled, the web server returns the /index.html file.

If it's disabled and the build includes a /404.html file, the web server returns that file instead. If no such file exists, the browser shows a blank page with a 404 response code.

Backend and Docker App Settings
Copy link

For backend applications, as well as applications deployed using a Dockerfile, Docker Compose, or a Docker Hub image, you can additionally configure the maximum request body size and a timeout for response headers.

Maximum Request Body Size
Copy link

This setting limits the size of incoming HTTP request bodies. For example, you can use it to cap the size of uploaded files.

Enter a number greater than 0. The value is measured in KB, so you don't need to specify a unit.

The maximum allowed request body size is 1,048,576 KB (1 GB).

If a request body exceeds this limit, the web server rejects the request before it reaches the application.

Response Header Timeout
Copy link

This setting defines how long the web server waits for response headers from the application.

Enter a number greater than 0. The value is measured in milliseconds, so you don't need to specify a unit. For example, to set a one-second timeout, enter 1000.

The maximum allowed timeout is 120,000 milliseconds (120 seconds).