core-geonetwork
core-geonetwork copied to clipboard
Extend http proxy to support urls with a duplicated parameter with different values
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
- [X] I have read the [contribution guidelines](https://github.com/geonetwork/core-geonetwork/blob/main/CONTRIBUTING.md
- [X] Pull request provided for
main
branch, backports managed with label - [X] Good housekeeping of code, cleaning up comments, tests, and documentation
- [X] Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
- [X] 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
Added a PR with the change to the proxy library https://github.com/mitre/HTTP-Proxy-Servlet/pull/243.
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
.