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

Base url used in responses from FHIR service use internal urls when behind an Application Gateway #3526

Open
dfjones1981 opened this issue Sep 18, 2023 · 8 comments
Labels
Bug Bug bug bug.

Comments

@dfjones1981
Copy link

Describe the bug
We have a FHIR server running in an Azure Health Data Services workspace. The FHIR server is not accessible directly, all requests are routed through a public endpoint at an Application Gateway. This means the url of the FHIR server is not exposed or usable externally. When we make requests to the FHIR server via the application gateway, the responses contain hateoas links to things like the next page of search results, but those links are using the internal url and therefore do not work. Is it possible to configure the FHIR server or the Application Gateway so that those urls use the correct external base url?

We've tried various options in the gateway backend settings for "Host name - Override with new host name". If we select No then every request returns 502 Bad Gateway.

If we select Yes and choose a specific Host Name other than the host name of the backend FHIR service i.e. xxx.fhir.azurehealthcareapis.com we get 502 Bad Gateway

If we select Yes and set the Host Name to the host name of the backend FHIR service then we get a correct response, but all the links in the response are internal links.

FHIR Version?
R4

Data provider?
SQL Server (Azure Health Data Services FHIR Service so inaccessible to us)

To Reproduce
Steps to reproduce the behavior:

  1. Configure an Azure Application Gateway to route requests to an Azure Health Data Services FHIR service
  2. Make a FHIR search query to the Gateway front end url
  3. Inspect the next and current properties of the response

Expected behavior
The next and current properties should be in the form https://my-external-url.com/

Actual behavior
The next and current properties are in the form https://xxx.fhir.azurehealthcareapis.com/

@dfjones1981 dfjones1981 added the Bug Bug bug bug. label Sep 18, 2023
@mikaelweave
Copy link
Contributor

Hi @dfjones1981, thanks for the detailed report. We don't currently support a way to customize the absolute URIs in response bodies that point to the FHIR Service. I've had success with this in the past using Azure API Management (with or without Application Gateway) as APIM makes this easy with the redirect-content-urls policy.

I do not think Application Gateway can modify the response body but am not an expert on Application Gateway.

@EXPEkesheth - the feature request here is to use the X-Forwarded-Host header in the request to dynamically change the response URLs (like next, current) depending on the path customers take to the service. API Gateway and APIM automatically insert X-Forwarded-* headers and this method is standard across the internet for gateways and CDNs.

This has been requested in the past: #1481

@dfjones1981
Copy link
Author

Thanks for the response @mikaelweave. It's disappointing that the feature isn't available today and we evaluated Azure API Management but didn't find it offered much value for our specific needs at this time.

We are at the end stages of rolling out a FHIR service for use by an entire province of Canada and will expect requests to integrate from many departments and applications over the coming months, it would be really valuable for us if this feature was prioritised again as we expect we'll have to ask integrators to replace urls on their side until it is supported.

Do we have any way of influencing the roadmap/prioritisation to show that this feature is valued by customers?

@EXPEkesheth
Copy link
Collaborator

Thanks @dfjones1981 for sharing the need for feature ! Can you please help me understand if you are Microsoft FHIR service managed service customer? If yes, will like to get more details.

@dfjones1981
Copy link
Author

We're using instances of Azure Health Data Services FHIR Service rather then deploying our own instance of a FHIR Service into other infrastructure.

@EXPEkesheth
Copy link
Collaborator

Thanks ! I would like to get more details. Can you please help create support ticket with information on usage expected, timeline and current workaround you have?

@LodewijkSioen
Copy link

Just want to chime in to say that we're dealing with the same issue. Right now we're using asp.net core Middleware to do the rewrites ourself.
Ideally this should not only rewrite the next, current,... URLs, but all references and things like the Location headers.

@EXPEkesheth
Copy link
Collaborator

#AB119108

@reubenelder
Copy link

I'd just like to add my support for adding this functionality. Currently we use AFD to an OSS instance in which we can set the url however we would like to move to AFD -> Managed Instance but this sounds like it will be an issue for us. Thanks

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

No branches or pull requests

5 participants