Issue #7471
closedAs a plugin developer, I can ship a webserver snippet that overrides a URL under /pulp/api/v3/
Description
galaxy_ng needs to be able to override how the webservers handle the URL: /pulp/api/v3/pulp_ansible/
It must no be sent to gunicorn, but that is what our webserver config files do for /pulp/api/v3/
galaxy_ng currently uses nginx, but presumably wants to use apache also.
For nginx:
- Plan A: Test/verify that no change is needed for a
location
snippet that overrides it. It should work because it is more specific, even though we include the snippet later. - Plan B: Move the include from line 100 to line 79 (before
location /pulp/api/v3
). Then Test existing plugins w/ snippets w/ this change to ensure no regressions.
Related issues
Updated by fao89 over 4 years ago
- Related to Issue #7481: Pulp 3 webserver config overwrites Pulp2 config added
Updated by bmbouter over 4 years ago
I think plan A will work for both nginx and apache maybe?
Then for galaxy_ng to disallow pulp_ansible urls they would have their snippet for nginx for example have:
location /pulp/api/v3/remotes/ansible/ {
return 404;
}
Prior to adding the above snippet on my system I can run http --verify=no https://localhost/pulp/api/v3/remotes/ansible/collection/
and I get
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 52
Content-Type: application/json
Date: Thu, 17 Sep 2020 18:06:48 GMT
Server: nginx/1.18.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 0,
"next": null,
"previous": null,
"results": []
}
After adding in the nginx config above (below the /pulp/api/v3/ part even) I run http --verify=no https://localhost/pulp/api/v3/remotes/ansible/collection/
, and I receive:
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 153
Content-Type: text/html
Date: Thu, 17 Sep 2020 18:09:05 GMT
Server: nginx/1.18.0
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>
Updated by mdepaulo@redhat.com over 4 years ago
bmbouter wrote:
I think plan A will work for both nginx and apache maybe?
Then for galaxy_ng to disallow pulp_ansible urls they would have their snippet for nginx for example have:
location /pulp/api/v3/remotes/ansible/ { return 404; }
Thank you very much. I verified it (but couldn't setup authentication with .netrc and curl, so I tried auth failed as the redirect happening to the app.)
I managed to acheive the same behavior with apache using the following snippet file:
# Disable ProxyPass & ProxyPassReverse so that the Redirect can work.
<Location "/pulp/api/v3/remotes/ansible/">
AllowOverride None # This line may not be necessary
ProxyPass "!"
ProxyPassReverse "!"
</Location>
Redirect 404 /pulp/api/v3/remotes/ansible/
Updated by mdepaulo@redhat.com over 4 years ago
- Category deleted (
Installer - Moved to GitHub issues) - Assignee changed from mdepaulo@redhat.com to bmbouter
- Tags Documentation added
Converting to a docs ticket, and removing from the installer. Since it will be in the developer docs.
Added by bmbouter over 4 years ago
Updated by pulpbot over 4 years ago
- Status changed from ASSIGNED to POST
Updated by bmbouter over 4 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|1ef9214df1918f896a5ca871199379ecc861ead5.
Updated by pulpbot about 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Adds docs on reverse proxy url customization
The snippets feature of plugins can be used to customize the behavior of the reverse proxy by including "more specific" routes that take precedence over less-specific routes the installer provides.
closes #7471