I have an Nginx load balancer that passes host onto the header when I make a request but my hypermedia links aren't including the port (8080). It works fine when I run my api instances separately but not with the nginx load balancer.
services.AddLinks(config =>
{
config.AddPolicy<User>(policy =>
{
policy.RequireSelfLink()
.RequireRoutedLink("get", "GetUser", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("post", "PostUser", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("put", "PutUser", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("delete", "DeleteUser", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("all", "GetUsers", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("requests", "GetRequestsByUserId", x => new { id = x.Id })
.RequireRoutedLink("root", "ApiRoot");
});
config.AddPolicy<Request>(policy =>
{
policy.RequireSelfLink()
.RequireRoutedLink("post", "PostRequest", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("put", "PutRequest", x => new { id = x.Id })
.RequireRoutedLink("delete", "DeleteRequest", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("all", "GetRequests", x => new { id = x.Id }, condition => condition.AuthorizeRoute())
.RequireRoutedLink("open", "GetOpenRequests")
.RequireRoutedLink("filter1", "GetRequestsByCityState")
.RequireRoutedLink("filter2", "GetRequestsByZip")
.RequireRoutedLink("root", "ApiRoot");
});
config.AddPolicy<Root>(policy =>
{
policy.RequireSelfLink()
.RequireRoutedLink("users", "GetUsers")
.RequireRoutedLink("requests", "GetRequests")
.RequireRoutedLink("account", "PostUser")
.RequireRoutedLink("reset", "ResetPassword");
});
});
I have an Nginx load balancer that passes host onto the header when I make a request but my hypermedia links aren't including the port (8080). It works fine when I run my api instances separately but not with the nginx load balancer.