Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
814 stars 147 forks source link

Publishing DAB through Microsoft Web Application Proxy #1785

Open rtharner opened 9 months ago

rtharner commented 9 months ago

HI,

I setup an container with DAB. Internally everything seems to be working fine, now i want to expose DAB to the internet with AzureAD as authentication method.

I published the External URL on WAP but the "next link" in the results still points to the internal link.

External link: https://integration.someurl.nl/ Internal link: http://somehostname.local:5555/ Webapplication Proxy: Microsoft Web Application Proxy (Windows Server 2019)

Result json externally:

"nextLink": " http://somehostname.local:5000/api/addresses?$after=W3siVmFsdWUiOiI0QzYxMzgwQi1GQjA1LUVFMTEtQjVENy0wMDE1NUQwQTcwM0IiLCJEaXJlY3Rpb24iOjAsIlRhYmxlU2NoZW1hIjoiZGJvIiwiVGFibGVOYW1lIjoiRmlsdGVyZWRBNFNBZGRyZXNzZXMiLCJDb2x1bW5OYW1lIjoiaWQifSx7IlZhbHVlIjoiNEM2MTM4MEItRkIwNS1FRTExLUI1RDctMDAxNTVEMEE3MDNCIiwiRGlyZWN0aW9uIjowLCJUYWJsZVNjaGVtYSI6ImRibyIsIlRhYmxlTmFtZSI6IkZpbHRlcmVkQTRTQWRkcmVzc2VzIiwiQ29sdW1uTmFtZSI6IkN1c3RvbWVyIn1d"

Which points to the internal addres instead of externally.

Am i missing a parameter or configuration in DAB?

Kind regards, Rogier

Aniruddh25 commented 9 months ago

Hi @rtharner, DAB doesnt have knowledge of your proxy. It creates the nextLink using the url from the request httpcontext which in this case would be the internal link. Is it possible in your client application to replace the internal address in the nextlink with your external link?

Thanks Aniruddh

rtharner commented 9 months ago

Hi @Aniruddh25 ,

Thanks for youre reply, Hmm no we are not able to change it in the client application we are running a enterprise service bus and we want to extend our services by adding possibility's to have an API for our customers. With DAB we think can provide this very easy. would be very nice when the next link would configurable in the config file.

for now i found a solution by adding some parameters to the container to let DAB run on 443 (Https) now we can make the internal and external URL equal to each other.

Kind regards, Rogier

rtharner commented 9 months ago

Hi @Aniruddh25 ,

Hmm unfortunately that didnt work , any thoughts about how to solve? i think it's because the certificate is self signed on hostname "localhost" is there an option to set a private certificate?

Kind regards, Rogier

WhiteRabbit-Code commented 1 week ago

Hi all, we're experiencing the same issue when running DAB behind an Azure API Management.

Can we add a config option to explicitly set the hostname and base-URL which are used for generating the nextLink? Or we could make use of the X-Forwarded-Host http-header, but that would lose the path part.