Skip to content

skynet multipart/form-data

Peter-Jan Brone requested to merge handle-multipart into master

MERGE REQUEST

Note

The api password exposed by this MR was rotated.

Overview

This MR enables POSTing form data to siad directly from the browser. By handling the multipart form data in siad we are able to cut out the NodeJS API entirely and proxypass upload requests in nginx directly to siad.

The following is an example location block that would properly proxy pass requests to the POST /skynet/skyfile endpoint. This was tested on hetzner 144.76.136.122, where I was able to upload several GBs of data in parallel without seeing any tmp files created nor memory increase.

	location /skynet/skyfile {
		client_max_body_size 1000M;
		proxy_read_timeout 600;
		proxy_pass http://127.0.0.1:9980;
		proxy_set_header Access-Control-Allow-Origin: *;
		proxy_set_header User-Agent: Sia-Agent;
		proxy_set_header Expect $http_expect;
		proxy_set_header Authorization "Basic [apipassword]";
		proxy_pass_header Authorization;
	}

Example for Visual changes (ie Screenshot)

N/A

Issues Closed

Checklist

Review and complete the checklist to ensure that the MR is complete before assigned to an approver.

  • All new methods, or updating methods have clear docstrings
  • Testing added or updated for new methods
  • Any new packages are added to Makefile and .gitlab-ci.yml
  • API documentation updated for API updates
  • Module README.md updated for changes to work flow
  • Issue added to Sia-UI repo for new supporting features
  • Changelog updated
Edited by Peter-Jan Brone

Merge request reports