@@ -427,23 +427,36 @@ assets
427
427
base_urls
428
428
.........
429
429
430
- **default **: ``{ http: [], ssl: [] } ``
430
+ **default **: ``[] ``
431
431
432
432
.. versionadded :: 2.7
433
433
The ``base_urls `` option was introduced in Symfony 2.7. Prior to Symfony
434
434
2.7, the option was called ``assets_base_urls `` and it was defined under
435
435
the ``templating `` key.
436
436
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.
441
441
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.
447
460
448
461
.. _ref-framework-assets-version :
449
462
0 commit comments