Aspire YARP custom domain instead of localhost
I have a legacy solution which we are migrating from IIS to aspire (after upgrading to dotnet 8).
Our solution relies on hosting on a single domain, so to ensure this we've added a YARP project to do the necessary reverse proxying from the different projects.
This works well, and we are able to navigate to for instance the swagger pages.
As mentioned though, we rely on running behind a custom domain, which we added to our host file. However we cannot seem to get the custom domain working on the aspire YARP project.
We've tried https://anthonysimmon.com/dotnet-aspire-non-localhost-endpoints/ but this only adds the custom domain in the dashboard. We appear to need to hook it up into the yarp project. But we can't seem to find the correct info on how to do this. (And potentially also how to 'terminate' HTTPS on YARP)
Any help is greatly appreciated.
Anthony Simmon
Use non-localhost endpoints for .NET Aspire resources
Learn how to use custom hosts instead of localhost for .NET Aspire resources during local development with or without a reverse proxy.
6 Replies
YARP config is basicly:
Routeconfig:
Clusterconfig:
with the backendUrl http://api1 etc...
.
yarp program.cs:
aspire:
api1 and api2 are net8 minimal api's, apiclient an angular spa
Unknown User•6d ago
Message Not Public
Sign In & Join Server To View
https://github.com/kvloover/CustomDomainAspire
Sadly this slimmed down version appears to be working, I'll try investigating if I properly cleaned up the IIS part i guess
GitHub
GitHub - kvloover/CustomDomainAspire
Contribute to kvloover/CustomDomainAspire development by creating an account on GitHub.
well aside from not providing the certificate ofc
Having a bit of silly trouble hosting the cert though. Ive tried setting the kestrel endpoints variable, but it needs an url. I don't know which url to pass as it's dynamically created by aspire
Unknown User•5d ago
Message Not Public
Sign In & Join Server To View
not really following there, but for now I'm just going to stick to localhost till I find the courage to deep dive into this again