httpd: redirect copr /api/ URLs to fedorainfracloud.org

See https://pagure.io/copr/copr/issue/1935

Prevent only /api_2, /api_3, etc from redirectring from
fedoraproject.org to fedorainfracloud.org

I am not entirely sure why do we need these special-cases for API but
you guys are taking care of it and keeping it updated, so it must be
important. If anyone can explain some context, it would be
appreciated. The config is older than my involvement in the Copr
project :-)

Anyway, there is only one /api/ page - https://copr.fedorainfracloud.org/api
and that is not an API endpoint that is programmatically accessed and
that preserves backwards compatibility. It is a page that one opens
in the web browser to find information about API, such as where the
documentation is, and how to obtain an API token.

We would like to apply the redirect from fedoraproject.org to
fedorainfracloud.org even for this page.
This commit is contained in:
Jakub Kadlcik 2022-01-07 22:11:44 +01:00 committed by kevin
parent e8fdcc2f54
commit cc920ed019
2 changed files with 2 additions and 2 deletions

View file

@ -1,3 +1,3 @@
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/api
RewriteCond %{REQUEST_URI} !^/api_
RewriteRule ^/(.*) https://copr.fedorainfracloud.org/$1 [L,R]

View file

@ -11,7 +11,7 @@ RequestHeader set X-Scheme https early
RequestHeader set X-Forwarded-Proto https early
{% endif %}
{% for path in ('api', 'api_2', 'api_3') %}
{% for path in ('api_2', 'api_3') %}
ProxyPass /{{path}} https://copr.fedorainfracloud.org/{{path}}
ProxyPassReverse /{{path}} https://copr.fedorainfracloud.org/{{path}}
{% endfor %}