core/corehttp: Added Suborigin header to gateway responses
Matt Bell committed
Feb 2, 2015 at 17:25 UTC
262e78122a4a0829056379332c4b4e330c1a837c
1 file changed
+6
core/corehttp/gateway_handler.go
+6
@@ -193,6 +193,12 @@ func (i *gatewayHandler) getHandler(w http.ResponseWriter, r *http.Request) {
193
194
w.Header().Set("X-IPFS-Path", p)
195
196
+ // Suborigin header, sandboxes apps from each other in the browser (even
197
+ // though they are served from the same gateway domain). NOTE: This is not
198
+ // yet widely supported by browsers.
199
+ pathRoot := strings.SplitN(urlPath, "/", 4)[2]
200
+ w.Header().Set("Suborigin", pathRoot)
201
+
202
dr, err := i.NewDagReader(nd)
203
if err != nil && err != uio.ErrIsDir {
204
// not a directory and still an error