-
Notifications
You must be signed in to change notification settings - Fork 157
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
link urls are wrong when originalRequestUriHeader contains unencoded pipe #1907
Comments
…ng it Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
I tested a few scenarios where this X-FHIR-FORWARDED-URI header produces really odd behavior |
I confirm that the problem in the description of this issue still exists. I did address it in one place (as tested in our updated UriBuilderTest), but I missed the fact that we also try to parse the incoming header value within FHIRRestServletFilter. As for the strange behavior on the fullUrl values of a search response bundle, I would consider that a separate (but related) issue. Here is the extent of the current documentation:
Additionally @d0roppe and I exchanged ideas for ways to improve on the design of this feature. Because our only use case for this is to override the FHIR Base URL, we feel that it would be simpler (and with fewer edge cases) to deprecate the Such a design change could be larger than we'd like at this point and so I propose we debate that in a separate issue. For this issue, I will:
|
Previously I updated our UriBuilder for this case (and introduced tests to ensure it is properly functioning). However, I missed the fact that FHIRREstServletFilter parses the originalRequestUri header value into a URI and, when this fails, it simply reverts to the actual URL of the request. Also performed some minor cleanup. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Previously I updated our UriBuilder for this case (and introduced tests to ensure it is properly functioning). However, I missed the fact that FHIRREstServletFilter parses the originalRequestUri header value into a URI and, when this fails, it simply reverts to the actual URL of the request. Also performed some minor cleanup. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Previously I updated our UriBuilder for this case (and introduced tests to ensure it is properly functioning). However, I missed the fact that FHIRREstServletFilter parses the originalRequestUri header value into a URI and, when this fails, it simply reverts to the actual URL of the request. Also performed some minor cleanup. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Previously I updated our UriBuilder for this case (and introduced tests to ensure it is properly functioning). However, I missed the fact that FHIRREstServletFilter parses the originalRequestUri header value into a URI and, when this fails, it simply reverts to the actual URL of the request. Also performed some minor cleanup. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Previously I updated our UriBuilder for this case (and introduced tests to ensure it is properly functioning). However, I missed the fact that FHIRREstServletFilter parses the originalRequestUri header value into a URI and, when this fails, it simply reverts to the actual URL of the request. Also performed some minor cleanup. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Previously I updated our UriBuilder for this case (and introduced tests to ensure it is properly functioning). However, I missed the fact that FHIRREstServletFilter parses the originalRequestUri header value into a URI and, when this fails, it simply reverts to the actual URL of the request. Also performed some minor cleanup. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Describe the bug
We are fronting the FHIR server with a reverse proxy and setting an originalRequestUriHeader to the frontend URI that was requested to the gateway.
On some requests, the search bundle response links come back with links that match our front-end url as expected. For example:
https://frontend-host/Observation?_count=10&code=57698-3&_page=10
But for other requests, its coming back with the backend server url which is not what we want:
https://backend-host/fhir-server/api/v4/Observation?_count=10&code=http://loinc.org|57698-3&_page=10
To Reproduce
Steps to reproduce the behavior:
|
Expected behavior
All generated links should have the frontend-url in them, not the backend-url
Additional context
Specifically, its failing on
URI requestUri = new URI(requestUriString);
in UriBuilder.toSearchSelfUri.If the originalRequestUriHeader value was properly encoded, it would work as expected. However, we should be more robust in our handling of cases where it is not. Furthermore, we don't even use the query portion of the originalRequestUriHeader (just the hostname and path), and so we should be able to avoid most encoding issues just by stripping off the query portion.
The text was updated successfully, but these errors were encountered: