Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep existing trailing slash in URL when forwarding request to insights #922

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

lfu
Copy link
Contributor

@lfu lfu commented Nov 8, 2024

Started GET "/redhat_access/r/insights/platform/module-update-router/v1/channel?module=insights-core" for 10.0.167.131 at 2024-11-07 13:49:01 -0500
Started GET "/redhat_access/r/insights/v1/static/testing/insights-core.egg" for 10.0.167.131 at 2024-11-07 13:49:54 -0500
Started GET "/redhat_access/r/insights/v1/systems/327dd693-3204-460a-a398-526d14ebe243" for 10.0.167.131 at 2024-11-07 13:50:22 -0500
Started POST "/redhat_access/r/insights/uploads/327dd693-3204-460a-a398-526d14ebe243" for 10.0.167.131 at 2024-11-07 13:51:21 -0500
Started GET "/redhat_access/r/insights/platform/inventory/v1/hosts?insights_id=327dd693-3204-460a-a398-526d14ebe243" for 10.0.167.131 at 2024-11-07 13:51:45 -0500
Started GET "/redhat_access/r/insights/platform/insights/v1/system/5db40f5f-d099-4077-9d90-7337d0ef6ea5/reports/" for 10.0.167.131 at 2024-11-07 13:54:39 -0500

Among these requests forwarded to Insights, only reports has the trailing slash in the request URL.
To avoid a redirect in Insights, let's keep the trailing slash in the request URL.

original_request.path in this line would remove a trailing stash if it exists.

Fixes #895

@@ -33,7 +33,8 @@ def prepare_request_opts(original_request, forward_payload, forward_params, cert
}
),
}
base_params.merge(path_params(original_request.path, certs))
requested_url = original_request.original_fullpath.end_with?('/') ? original_request.path + '/' : original_request.path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for /redhat_access/r/insights/v1/static/testing/insights-core.egg where we probably dont want the /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Requests to /api/insights/v1/system/<uuid>/reports lack trailing slash
2 participants