Skip to content

Commit f897447

Browse files
authored
Merge pull request #6131 from stsewd/use-setting-for-footer-api
Use different setting for footer api url
2 parents aa9cc9f + 86ec633 commit f897447

File tree

8 files changed

+11
-3
lines changed

8 files changed

+11
-3
lines changed

readthedocs/core/static-src/core/js/doc-embed/footer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function init() {
6464

6565
// Get footer HTML from API and inject it into the page.
6666
$.ajax({
67-
url: rtd.api_host + "/api/v2/footer_html/",
67+
url: rtd.proxied_api_host + "/api/v2/footer_html/",
6868
crossDomain: true,
6969
xhrFields: {
7070
withCredentials: true,

readthedocs/core/static-src/core/js/doc-embed/rtd-data.js

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function get() {
5353

5454
var defaults = {
5555
api_host: 'https://readthedocs.org',
56+
proxied_api_host: 'https://readthedocs.org',
5657
ad_free: false,
5758
};
5859

readthedocs/core/static/core/js/readthedocs-doc-embed.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readthedocs/doc_builder/backends/mkdocs.py

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def generate_rtd_data(self, docs_dir, mkdocs_config):
237237
'docroot': docs_dir,
238238
'source_suffix': '.md',
239239
'api_host': settings.PUBLIC_API_URL,
240+
'proxied_api_host': settings.RTD_PROXIED_API_URL,
240241
'ad_free': not self.project.show_advertising,
241242
'commit': self.version.project.vcs_repo(self.version.slug).commit,
242243
'global_analytics_code': settings.GLOBAL_ANALYTICS_CODE,

readthedocs/doc_builder/backends/sphinx.py

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def get_config_params(self):
127127
'settings': settings,
128128
'conf_py_path': conf_py_path,
129129
'api_host': settings.PUBLIC_API_URL,
130+
'proxied_api_host': settings.RTD_PROXIED_API_URL,
130131
'commit': self.project.vcs_repo(self.version.slug).commit,
131132
'versions': versions,
132133
'downloads': downloads,

readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ context = {
9696
'single_version': {{ project.single_version }},
9797
'conf_py_path': '{{ conf_py_path }}',
9898
'api_host': '{{ api_host }}',
99+
'proxied_api_host': '{{ proxied_api_host }}',
99100
'github_user': '{{ github_user }}',
100101
'github_repo': '{{ github_repo }}',
101102
'github_version': '{{ github_version }}',

readthedocs/projects/static/projects/js/tools.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readthedocs/settings/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class CommunityBaseSettings(Settings):
4141
PUBLIC_DOMAIN_USES_HTTPS = False
4242
USE_SUBDOMAIN = False
4343
PUBLIC_API_URL = 'https://{}'.format(PRODUCTION_DOMAIN)
44+
# Some endpoints from the API can be proxied on other domain
45+
# or use the same domain where the docs are being served
46+
# (omit the host if that's the case).
47+
RTD_PROXIED_API_URL = PUBLIC_API_URL
4448
EXTERNAL_VERSION_URL = None # for pull request builds
4549

4650
# Doc Builder Backends

0 commit comments

Comments
 (0)