Task #6057
closed[EPIC] Introduce custom plugin snippets for custom apache and nginx routes
100%
Description
Plugins like pulp_container and pulp_ansible need custom API routes. Sometimes these are for the pulp-content-app or in other cases the pulp-api.
Background¶
Currently Nginx that matches /pulp/api/v3
and routes that to the pulp-api. It also matches /pulp/content/
and routes that to the pulp-content-app. If neither match it first "tries one" and if that 404's it "tries the other". This is problematic for a few reasons:
- Apache doesn't support it. At the moment, Apache users are not receiving at all the same experience as Nginx
- It's not working well even for nginx. In pulp_ansible recently I had to add this snippet to my dev checkout or tests wouldn't pass. It was trying one service but then not the other.
location /pulp_ansible/galaxy/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://127.0.0.1:24817;
}
Solution¶
Have each plugin ship a snippet that allows them to define custom routes for both nginx and apache. Then have the installer configure these snippets when configuring nginx or apache (as it already does).
We want to keep the snippets delivered through plugin code because it needs to be versioned with the plugin code. We can use these python mechansisms to ship the configs and make them discoverable by the installer:
https://importlib-resources.readthedocs.io/en/latest/using.html
Related issues