Open yhao3 opened 1 month ago
Is this an issue that causes functionality to break?
Hi @mraible:
This issue only affects the URL display in the response Link
header, so it's not a critical error as it doesn't break the core functionality. However, the potential problem arises when a client application accesses the paginated API through the API Gateway and relies on the Link
header for navigation. In that case, the incorrect URLs in the Link
header would lead to issues with paginated requests.
@yhao3 If you can submit a PR, I'd be happy to review it.
Hi @mraible,
Thank you for your response! I’ve submitted a PR addressing the issue we discussed. I wanted to mention that, based on my understanding, using forwarded headers may introduce potential security concerns. Given this, I’m uncertain whether the current approach is the best solution.
I would appreciate your thoughts on this matter, especially considering the security implications.
Thank you!
Overview of the issue
Recently, while using JHipster to build a microservice application, I encountered an issue with pagination APIs.
Since the pagination API in microservices follows RFC 5988 (Web Linking), when we call a paginated API through the gateway, we can see headers in the API response similar to the following:
However, it's clear that the value in the Link header is incorrect. The microservice should dynamically adjust the response based on the
X-Forwarded-Prefix
header forwarded by the gateway, such as:Motivation for or Use Case
This issue is problematic because the microservices should respect the gateway’s forwarded headers when constructing the pagination links.
Reproduce the error
X-Forwarded-Prefix
.Related issues
A similar issue is #26521, but it discusses security concerns with Forwarded headers.
Suggest a Fix
According to the official Spring documentation, we can resolve this by:
ForwardedHeaderFilter
.ForwardedHeaderTransformer
.server.forward-headers-strategy
toFRAMEWORK
.Is there a better solution to handle this situation while considering the security implications?
JHipster Version(s)
JHipster version: latest
JHipster configuration
JDL:
Browsers and Operating System