Issue with Endpoint Definition in Microservices Setup with tusdotnet on .NET 8

Hi everyone,

I’m currently working on a web application using .NET 8 that involves several microservices.

We have an authentication gateway that acts as a proxy, checking the authentication of incoming requests and then forwarding them to the appropriate microservice POD.

Here’s a brief overview of our setup:

  • Web Application URL: https://my-web-application/
  • Microservice Endpoint: https://my-web-application/microservice/api/v1/files
  • tusdotnet Endpoint Definition: /api/v1/files
  • Client Library: tus-js-client

The issue I’m encountering is that the client is configured to use the endpoint definition /api/v1/files with the host https://my-web-application/, but it doesn’t account for the necessary sub-module definition (in this case, microservice). This discrepancy is causing problems with routing the requests correctly.

Has anyone faced a similar issue or can provide guidance on how to configure tusdotnet to work with our microservices setup? Any help or suggestions would be greatly appreciated!

Here the configuration code:

private static void ConfigureMapTus( IEndpointRouteBuilder app, Serilog.ILogger logger )
{
   string urlPath = "/api/v1/files";
   _ = app.MapTus(urlPath, async (HttpContext httpContext) =>
   {
      DefaultTusConfiguration config = new  ()
      {
         Store = new TusDiskStore(@"/tmp/"),
         Events = new()
         {
            OnFileCompleteAsync = async ( FileCompleteContext context ) =>
            {
               ITusFile file = await context.GetFileAsync().ConfigureAwait(false);
               Dictionary<string, Metadata> metadata = await file.GetMetadataAsync(context.CancellationToken).ConfigureAwait(false);
               logger.Information("TUS.IO - FileComplete: {0}", JsonSerializer.Serialize(metadata));
            }
         }
      };

      return await Task.FromResult(config).ConfigureAwait(false);
   });
}

And here some screenshots on what the client i’ve used (tus-js-client) is requesting/receiving (I’m doing a port-forward to access the server from my computer, that’s why I’ve calls to localhost):

Thanks in advance!

Hello,

I am not sure of the author of tusdotnet is active in this forum here. I would recommend you to ask this question as an issue in its repository on GitHub: GitHub - tusdotnet/tusdotnet: .NET server implementation of the Tus protocol for resumable file uploads. Read more at https://tus.io

1 Like