diff --git a/cmd/http-gw/app.go b/cmd/http-gw/app.go index b26df89..9b2c9e5 100644 --- a/cmd/http-gw/app.go +++ b/cmd/http-gw/app.go @@ -593,6 +593,10 @@ func (a *app) configureRouter(handler *handler.Handler) { r.POST("/upload/{cid}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.Upload)))))) a.log.Info(logs.AddedPathUploadCid) r.GET("/get/{cid}/{oid:*}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.DownloadByAddressOrBucketName)))))) + r.OPTIONS("/get/{cid}/{oid:*}", func(ctx *fasthttp.RequestCtx) { + ctx.Response.Header.Set(fasthttp.HeaderAccessControlAllowOrigin, "*") + ctx.Response.Header.Set(fasthttp.HeaderAccessControlAllowHeaders, "Authorization") + }) r.HEAD("/get/{cid}/{oid:*}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.HeadByAddressOrBucketName)))))) a.log.Info(logs.AddedPathGetCidOid) r.GET("/get_by_attribute/{cid}/{attr_key}/{attr_val:*}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.DownloadByAttribute)))))) diff --git a/internal/handler/reader.go b/internal/handler/reader.go index 50121c9..3ede407 100644 --- a/internal/handler/reader.go +++ b/internal/handler/reader.go @@ -120,6 +120,7 @@ func (h *Handler) receiveFile(ctx context.Context, req request, objAddress oid.A req.setDisposition(shouldDownload, filename) + req.Response.Header.Set(fasthttp.HeaderAccessControlAllowOrigin, "*") req.Response.Header.Set(fasthttp.HeaderContentLength, strconv.FormatUint(payloadSize, 10)) if len(contentType) == 0 { diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..4050a9d --- /dev/null +++ b/web/index.html @@ -0,0 +1,27 @@ + + +
+ +