I've successfully set up YARP as a reverse proxy, and it works well for routes that don't require authorization. However, I'm facing challenges when trying to include credentials for accessing destination APIs or sites. Can anyone guide me on how to manage this aspect with YARP?
This is what I tried before. But, it seems the credentials(HTTP_Authorization
) is not working. I have userName
and password
, but don't know where to put it. And maybe it's not best to put it the userName
and password
on config files right?
"ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "cluster1",
"Order": 1,
"Match": {
"Path": "/somePath/{**path1}"
},
"Transforms": [
{
"PathPattern": "/somePattern/{**path1}"
},
{
"RequestHeader": "HTTP_Authorization",
"Set": "Basic someAuthorizationHashKey"
}
]
},
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://someSitewithCredentials"
}
}
},
}
}
Thank you
I have wrong request header. In IIS, the header is
HTTP_Authorization
. I thought it's same with yarp. But for yarp reverse proxy, it works withAuthorization
.And for
username
andpassword
, it reflects onsomeAuthorizationHashKey
.So, it's closed case