Endpoint |
Description |
diff --git a/swh/web/api/templates/api.html b/swh/web/api/templates/api.html
--- a/swh/web/api/templates/api.html
+++ b/swh/web/api/templates/api.html
@@ -294,7 +294,7 @@
The following shows how to perform an authenticated request to the Web API using curl
.
export TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhMTMxYTQ1My1hM2IyLTQwMTUtO...
- curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}api/...
+ curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}/api/...
Authenticated requests can be used to lift rate limiting if the user account has the adequate
diff --git a/swh/web/api/templates/apidoc.html b/swh/web/api/templates/apidoc.html
--- a/swh/web/api/templates/apidoc.html
+++ b/swh/web/api/templates/apidoc.html
@@ -71,7 +71,7 @@
{% for url in urls %}
- {{ url.rule | docstring_display | safe }} |
+ {{ site_base_url|add:url.rule | docstring_display | safe }} |
{{ url.methods | dictsort:0 | join:', ' }} |
{% endfor %}
diff --git a/swh/web/auth/templates/profile.html b/swh/web/auth/templates/profile.html
--- a/swh/web/auth/templates/profile.html
+++ b/swh/web/auth/templates/profile.html
@@ -75,7 +75,7 @@
For instance when using curl
proceed as follows:
-
curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}api/...
+ curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}/api/...
Please not that a bearer token will automatically expire after 30 days of inactivity.
diff --git a/swh/web/utils/__init__.py b/swh/web/utils/__init__.py
--- a/swh/web/utils/__init__.py
+++ b/swh/web/utils/__init__.py
@@ -305,7 +305,7 @@
"oidc_enabled": bool(config["keycloak"]["server_url"]),
"browsers_supported_image_mimes": browsers_supported_image_mimes,
"keycloak": config["keycloak"],
- "site_base_url": request.build_absolute_uri("/"),
+ "site_base_url": request.build_absolute_uri("/")[:-1],
"DJANGO_SETTINGS_MODULE": os.environ["DJANGO_SETTINGS_MODULE"],
"status": config["status"],
"swh_web_dev": is_swh_web_development(request),