kubo/core/corehttp
Marcin Rataj f9567a0a0f fix(gateway): curl without redirect on localhost
When request is sent to http://localhost:8080/ipfs/$cid response has
HTTP 301 status code and "Location" header with redirect destination at
$cid.ipfs.localhost:8080

Redirect is followed by browsersi, but not by commandline tools.
Status 301 is ignored by curl in default mode: it will print response
and won't follow redirect, user needs to add -L for that.

To fix curl, we return correct payload in body of HTTP 301 response,
but set Clear-Site-Data header to ensure Origin sandbox can't be abused.

This requires a surgical workaround:
If Location header is present in ResponseWriter's Header map,
we ensure http.ServeContent() returns HTTP 301

Context: https://github.com/ipfs/go-ipfs/pull/6982

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2020-03-18 08:50:40 -07:00
..
commands.go fix: migrate from deprecated warning function 2020-01-28 21:20:21 -08:00
corehttp.go feat(gateway): subdomain and proxy gateway 2020-03-18 08:50:38 -07:00
gateway_handler.go fix(gateway): curl without redirect on localhost 2020-03-18 08:50:40 -07:00
gateway_indexPage.go show hash if not in original url 2019-01-05 11:16:17 -08:00
gateway_test.go feat(gateway): subdomain and proxy gateway 2020-03-18 08:50:38 -07:00
gateway.go http: use Method* constants 2020-01-10 10:19:08 +01:00
hostname_test.go feat(gateway): subdomain and proxy gateway 2020-03-18 08:50:38 -07:00
hostname.go fix(gateway): curl without redirect on localhost 2020-03-18 08:50:40 -07:00
lazyseek_test.go test(gateway): test the lazy seeker 2020-01-05 16:43:45 -08:00
lazyseek.go fix(gateway): fix seek read length typo 2020-01-05 16:43:45 -08:00
logs.go fix(tracing): remove event tracing 2020-01-28 21:31:12 -08:00
metrics_test.go migrate to go-libp2p-core. 2019-05-31 23:23:52 -07:00
metrics.go pass opts.Namespace along like before 2019-10-23 10:46:11 +10:00
mutex_profile.go fix: use http.Error for sending errors 2019-05-25 10:45:17 -07:00
option_test.go http: use Method* constants 2020-01-10 10:19:08 +01:00
p2p_proxy_test.go rename ProxyOption to P2PProxyOption 2020-03-17 19:34:44 -07:00
p2p_proxy.go rename ProxyOption to P2PProxyOption 2020-03-17 19:34:44 -07:00
redirect.go fix the wrong path configuration in root redirection 2019-04-15 12:35:45 +09:00
webui.go feat: web ui 2.7.2 2019-12-04 08:15:58 +00:00