Web property

The web property defines how your application is exposed to the web (in HTTP), determines how the web application serves content, and controls how the application container responds to incoming requests by setting rules in each location block. A block represents an absolute path leading with a forward slash (/).

            # The public directory of the app, relative to its root.

You can fine-tune your locations configuration using the following key values for each locations block:

Serve files that do not match the “rules”. Default value = true
Set the number of seconds to cache content in the browser. This key enables the cache-control and expires headers for static content. If this value is not set, the expires directive and resulting headers are not included when serving static content files. A negative 1 (-1) value results in no caching and is the default value. You can express time value with the following units: ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks), M (months, 30d), or y (years, 365d)
Set custom headers, such as X-Frame-Options, for static content served from this location.
List the static files to serve your application, such as the index.html file. This key expects a collection. This only works if access to the file or files is “allowed” by the allow or rules key for this location.
Specify overrides for a location. Use a regular expression to match a request. If an incoming request matches the rule, then regular handling of the request is overridden by the keys used in the rule.
Set the URL used in case a static file or PHP file cannot be found. Typically, this URL is the front controller for your applications, such as /index.php or /app.php.
Set the path relative to the root of the application that is exposed on the web. The public directory (location “/”) for a Cloud project is set to “pub” by default.
Allow loading scripts in this location. Set the value to true to allow scripts.

The default configuration allows the following:

  • From the root (/) path, only web and media can be accessed
  • From the ~/pub/static and ~/pub/media paths, any file can be accessed

The following example shows the default configuration in the .magento.app.yaml file for a set of web-accessible locations associated with an entry in the mounts property:

 # The configuration of app when it is exposed to the web.
            # The public directory of the app, relative to its root.
            root: "pub"
            # The front-controller script to send non-static requests to.
            passthru: "/index.php"
                - index.php
            expires: -1
            scripts: true
            allow: false
                    allow: true
                    passthru: "/media/sitemap$1.xml"
            root: "pub/media"
            allow: true
            scripts: false
            expires: 1y
            passthru: "/get.php"
            root: "pub/static"
            allow: true
            scripts: false
            expires: 1y
            passthru: "/front-static.php"
                    passthru: "/static/$resource"
This example shows the default web configuration for a Cloud project configured to support a single domain. For a project that requires support for multiple websites or stores, the web configuration must be set up to support shared domains. See Configure locations for shared domains.