Destination is returning 404 when proxied #2757
-
Hi, I created this very basic proxy that for some reason it is returning 404 for proxied calls. If I call the destination directly it works as expected. Can someone give me some light of what may be happening here? var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromMemory(new[]
{
new RouteConfig
{
RouteId = "proxy-route",
ClusterId = "proxy-cluster",
Match = new RouteMatch
{
Path = "{**catch-all}"
}
}
},
new[]
{
new ClusterConfig
{
ClusterId = "proxy-cluster",
Destinations = new Dictionary<string, DestinationConfig>
{
{ "destination1", new DestinationConfig { Address = "https://rpc.edu-chain.raas.gelato.cloud/API KEY GOES HERE" } }
}
}
});
var app = builder.Build();
app.MapReverseProxy();
app.Run(); This destination has a free endpoint where you can just omit the api key and it works. When omitted, the proxied call works but it doesn't when it is specified. Really confusing. Here is an example of an http call, which should be a POST with the following body: {
"jsonrpc": "2.0",
"method": "eth_getBlockReceipts",
"params": [
"0xf3c2a555d10781c6394433b1e287c02af6e3a04cfc6a3cb7b32ad2830fc20bfa"
],
"id": 1
} I have also noticed that if you specify a wrong api key in postman it returns unauthorized but if proxied it also returns 404. I have this code running for other destinations and it works just fine. Could it be something related with this specific host? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
First guess would be that the backend server is picky about differences in headers. If that doesn't work, try doing a network capture to see if/how requests differ. |
Beta Was this translation helpful? Give feedback.
There is no such thing as an "empty path" here, it'll always be at least a single
/
.And that one slash will be combined with your prefix, resulting in the trailing slash.
Your transform ignored the incoming request and just uses the prefix, hence no slash.