8000 Fixed the description of the new "base_urls" option · symfony/symfony-docs@49221c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49221c2

Browse files
committed
Fixed the description of the new "base_urls" option
1 parent 5200ee7 commit 49221c2

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

reference/configuration/framework.rst

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -427,23 +427,36 @@ assets
427427
base_urls
428428
.........
429429

430-
**default**: ``{ http: [], ssl: [] }``
430+
**default**: ``[]``
431431

432432
.. versionadded:: 2.7
433433
The ``base_urls`` option was introduced in Symfony 2.7. Prior to Symfony
434434
2.7, the option was called ``assets_base_urls`` and it was defined under
435435
the ``templating`` key.
436436

437-
This option allows you to define base URLs to be used for assets referenced
438-
from ``http`` and ``ssl`` (``https``) pages. A string value may be provided in
439-
lieu of a single-element array. If multiple base URLs are provided, Symfony
440-
will select one from the collection each time it generates an asset's path.
437+
This option allows you to define the base URLs used to generate the asset's paths.
438+
A string value may be provided instead of a single-element array. If multiple base
439+
URLs are provided, Symfony selects one from the collection each time it generates
440+
an asset's path.
441441

442-
For your convenience, ``base_urls`` can be set directly with a string or array of
443-
strings, which will be automatically organized into collections of base URLs
444-
for ``http`` and ``https`` requests. If a URL starts with ``https://`` or is
445-
`protocol-relative`_ (i.e. starts with ``//``) it will be added to both collections.
446-
URLs starting with ``http://`` will only be added to the ``http`` collection.
442+
The selection of the base URL is request context-sensitive. If the rendered page
443+
is secure, assets are only served via ``https://`` or protocol-relative (``//``)
444+
URLs. If the page is non-secure, all provided URLs will be considered (even secure
445+
``htpps://`` URLs).
446+
447+
If your ``base_urls`` option is the following:
448+
449+
.. code-block:: yaml
450+
451+
framework:
452+
assets:
453+
base_urls:
454+
- 'http://static.example.com/'
455+
- '//assets.example.com/'
456+
- 'https://contents.example.com'
457+
458+
Assets loaded in non-secure pages will use any of the three URLs. However, assets
459+
loaded in secure pages will only use the last two URLs defined.
447460

448461
.. _ref-framework-assets-version:
449462

0 commit comments

Comments
 (0)
0