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

Extend http proxy to support urls with a duplicated parameter with different values #7456

Merged

Conversation

josegar74
Copy link
Member

Currently the http proxy doesn't support to send a parameter repeated in the url with different values. This causes Kibana when proxied to fail some requests like the following :

http://localhost:8080/geonetwork/dashboards/api/index_patterns/_fields_for_wildcard?pattern=gn-records&meta_fields=_source&meta_fields=_id&meta_fields=_type&meta_fields=_index&meta_fields=_score

The original code relies in org.mitre.dsmiley.httpproxy.URITemplateProxyServlet.service method, that used a list of parameters. This change uses a map with a list of values instead.

It should be check to send a pull to https://github.com/mitre/HTTP-Proxy-Servlet to apply the changes in org.mitre.dsmiley.httpproxy.URITemplateProxyServlet.service. But this can take a while until merged and released in HTTP-Proxy-Servlet project.

Checklist

  • I have read the [contribution guidelines](https://github.com/geonetwork/core-geonetwork/blob/main/CONTRIBUTING.md
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests)
  • User documentation provided for new features or enhancements in mannual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

@juanluisrp
Copy link
Contributor

Added a PR with the change to the proxy library mitre/HTTP-Proxy-Servlet#243.

@fxprunayre fxprunayre modified the milestones: 4.4.1, 4.4.2 Nov 22, 2023
@fxprunayre fxprunayre modified the milestones: 4.4.2, 4.4.3 Jan 23, 2024
Copy link
Contributor

@juanluisrp juanluisrp left a comment

Choose a reason for hiding this comment

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

LGTM.

@juanluisrp juanluisrp added the bug label Feb 16, 2024
@juanluisrp juanluisrp force-pushed the http-proxy-urlparam-multiplevalues branch from 7b67e82 to 8db06b1 Compare March 7, 2024 16:09
Extend URITemplateProxyServlet to support urls with a duplicated
parameter with different values, like: param1=value1&param1=value2&param1=value3

Fix wrong init parameter name
@juanluisrp juanluisrp force-pushed the http-proxy-urlparam-multiplevalues branch from b00cd29 to 7198ba7 Compare March 12, 2024 08:37
@juanluisrp juanluisrp merged commit 97c2e71 into geonetwork:main Mar 12, 2024
6 checks passed
@geonetworkbuild
Copy link
Collaborator

The backport to 4.2.x failed:

The process '/usr/bin/git' failed with exit code 1
stderr
error: could not apply 7198ba760b... Extend proxy to manage duplicated parameters
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

stdout
Auto-merging web/src/main/java/org/fao/geonet/proxy/URITemplateProxyServlet.java
CONFLICT (content): Merge conflict in web/src/main/java/org/fao/geonet/proxy/URITemplateProxyServlet.java

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.2.x 4.2.x
# Navigate to the new working tree
cd .worktrees/backport-4.2.x
# Create a new branch
git switch --create backport-7456-to-4.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 7198ba760b8aab44d1c2141b2e707bc464c73f7f
# Push it to GitHub
git push --set-upstream origin backport-7456-to-4.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.2.x

Then, create a pull request where the base branch is 4.2.x and the compare/head branch is backport-7456-to-4.2.x.

juanluisrp added a commit that referenced this pull request Mar 12, 2024
Extend URITemplateProxyServlet to support urls with a duplicated
parameter with different values, like: param1=value1&param1=value2&param1=value3

Fix wrong init parameter name
@juanluisrp juanluisrp deleted the http-proxy-urlparam-multiplevalues branch March 12, 2024 10:33
juanluisrp added a commit that referenced this pull request Mar 12, 2024
Extend URITemplateProxyServlet to support urls with a duplicated
parameter with different values, like: param1=value1&param1=value2&param1=value3

Fix wrong init parameter name

Backport of #7456.
josegar74 added a commit to GeoCat/core-geonetwork that referenced this pull request Mar 12, 2024
@josegar74 josegar74 mentioned this pull request Mar 12, 2024
10 tasks
juanluisrp pushed a commit that referenced this pull request Mar 12, 2024
geonetworkbuild pushed a commit that referenced this pull request Mar 12, 2024
juanluisrp pushed a commit that referenced this pull request Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants