Skip to content

debusine client: manage HTTP 301 redirects (report to user? Make them unexpected?)

I have a test instance of debusine-server.

Last week (when testing salsa single sign on integration) I enabled SSL (via Let's Encrypt).

The situation today:

  • /etc/nginx/sites-available/debusine.conf/ has if ($host = debusine.pina.cat) { return 301 https://$host$request_uri; }
  • debusine client create-artifact: POST request that Nginx redirected to 301.
  • debusine.client followed the redirect but then issued a GET
  • Output of debusine client was: result: failure\nerror: title: Error (confusing)

The server logs had:

2023-11-13 14:45:25,831 [exceptions/2033/140620221662912] ERROR: Server exception. status_code: 400 detail: None traceback: Traceback (most recent call last):\n  File "/usr/lib/python3/dist-packages/rest_framework/views.py", line 506, in dispatch\n    response = handler(request, *args, **kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: ArtifactView.get() missing 1 required positional argument: 'artifact_id'\n

Solution: fix ~/.config/debusine/client/config.ini to use https (or correct URL, new server URL, etc.).

That confused me, for a user might be more confusing?

Possible improvements for clients configured in a way that the server returns 301:

  • debusine.client perhaps should stop, explain the situation, give some idea on what to check if a HTTP request returned a 301? (302 is ok when the object is created, 301 is weird on an HTTP POST). That could be done via allow_redirect and allowing 302
  • debusine.server has exception handling: could be perhaps improved to include more information

Feel free to close this issue if this is a "badly configured client for the server".

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information