Uppy throws error "tus: invalid or missing Location header, originated from request" even though location header is present

I am currently working on a project that needs to implement the TUS protocol, because we are uploading large files (20+ GB) that need to be interruptable.

We have a server that implements the TUS protocol using the servlet implementation from Tom Desair (https://github.com/tomdesair/tus-java-server).
Before we start customizing the servlet to fit our needs, we tested the servlet out using the Spring Boot example that is mentioned in the README of the servlet repository.
This example works just fine using the provided java client and the upload succeeds.

However, when we tried communicating with the server using the Uppy CDN example mentioned in the Getting Started Guide, we are receiving the following error when creating an upload resource on the POST request:
Failed to upload 03ffbb3f-b13f-4fe7-b09b-d62806b1203c.jpg tus: invalid or missing Location header, originated from request (method: POST, url: http://localhost:8080/api/upload, response code: 201, response text: , request id: n/a)

The weird thing is however that the response sent by the server back to the CDN example contains the following headers:

HTTP/1.1 201 
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Access-Control-Allow-Origin: *
Tus-Resumable: 1.0.0
Location: http://localhost:8080/api/upload/6c51a7b3-1fe0-44c0-af5d-5aa516ec140e
Content-Length: 0
Date: Tue, 19 Jul 2022 12:02:58 GMT
Keep-Alive: timeout=60
Connection: keep-alive

To reproduce this error, do the following:

  1. Checkout the example repository: https://github.com/tomdesair/tus-java-server-spring-demo
  2. Setup the CDN example from the Getting Started page: https://uppy.io/docs/
  3. Start the Spring Boot application
  4. Change the upload URL of the CDN example to http://localhost:8080/api/upload
  5. Upload a file using the CDN example and observe the network tab

It is clearly visible that the Location header is present. Can someone explain why we are receiving this error? To us, it seems like it is a bug within Uppy itself, but we may be wrong about that and just doing something wrong.

For anyone interested: This is also reported in Uppy throws error "tus: invalid or missing Location header, originated from request" even though location header is present · Issue #3891 · transloadit/uppy · GitHub, where we try to debug this issue.

1 Like