|
| 1 | +Cross-site requests |
| 2 | +=================== |
| 3 | + |
| 4 | +Cross site requests are allowed for the following endpoints: |
| 5 | + |
| 6 | +- :ref:`/api/v2/footer_html/ <api/v2:Undocumented resources and endpoints>` |
| 7 | +- :ref:`/api/v2/search/ <server-side-search/api:API V2 (deprecated)>` |
| 8 | +- :ref:`/api/v2/embed/ <api/v2:Embed>` |
| 9 | +- :ref:`/api/v2/sustainability/ <api/v2:Undocumented resources and endpoints>` |
| 10 | +- :ref:`/api/v3/embed/ <api/v3:Embed>` |
| 11 | + |
| 12 | +Except for the sustainability API, all of the above endpoints |
| 13 | +don't allow you to pass credentials in cross-site requests. |
| 14 | +In other words, these API endpoints allow you to access **public information only**. |
| 15 | + |
| 16 | +On a technical level, this is achieved by implementing the CORS_ standard, |
| 17 | +which is supported by all major browsers. |
| 18 | +We implement it such way that it strictly match the intention of the API endpoint. |
| 19 | + |
| 20 | +.. _CORS: https://en.wikipedia.org/wiki/Cross-origin_resource_sharing |
| 21 | + |
| 22 | +Cookies |
| 23 | +------- |
| 24 | + |
| 25 | +On |org_brand|, our session cookies have the ``SameSite`` attribute set to ``None``, |
| 26 | +this means they can be sent in cross site requests. |
| 27 | +This is needed for our sustainability API only, |
| 28 | +to not show ads if the current user is a :ref:`Gold User <advertising/ad-blocking:Going ad-free>`. |
| 29 | +All resources in |org_brand| are public, you don't need to pass cookies to make use |
| 30 | +of our allowed APIs from other sites. |
| 31 | + |
| 32 | +On |com_brand|, our session cookies have the ``SameSite`` attribute set to ``Lax``. |
| 33 | +This means that browsers will not include them in cross site requests. |
| 34 | +If you need to have access to versions that the current user has permissions over, |
| 35 | +you can make use of our proxied APIs, they can be accessed from docs domains with the `/_/` prefix. |
| 36 | +For example, you can make use of our search API from `<your-docs-domain>/_/api/v2/search/`. |
0 commit comments