Refactor: using path style when signurl by console

Signed-off-by: Mofei Zhang <mofei2816@gmail.com>
This commit is contained in:
Mofei Zhang 2020-07-08 12:27:37 +08:00
parent 98f072cba5
commit 5ff0c87859
No known key found for this signature in database
GPG Key ID: 7C19725C197AE672
2 changed files with 12 additions and 6 deletions

View File

@ -4,6 +4,11 @@ import (
"context"
"encoding/json"
"fmt"
"net/http"
"strconv"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
@ -16,10 +21,6 @@ import (
"github.com/chubaofs/chubaofs/util/log"
"github.com/samsarahq/thunder/graphql"
"github.com/samsarahq/thunder/graphql/schemabuilder"
"net/http"
"strconv"
"strings"
"time"
)
type FileService struct {
@ -271,6 +272,7 @@ func (fs *FileService) signURL(ctx context.Context, args struct {
ac.DisableSSL = aws.Bool(true)
ac.Region = aws.String("default")
ac.Credentials = credentials.NewStaticCredentials(userInfo.Access_key, userInfo.Secret_key, "")
ac.S3ForcePathStyle = aws.Bool(true)
s3Svc := s3.New(sess, ac)
request, _ := s3Svc.GetObjectRequest(&s3.GetObjectInput{
Bucket: aws.String(args.VolName),

View File

@ -43,6 +43,10 @@ http {
server 192.168.0.43:80;
}
upstream consoles {
server 192.168.0.50:80;
}
server {
listen 80;
server_name object.chubao.io ~^(?<bucket>.+)\.object\.chubao\.io$;
@ -64,11 +68,11 @@ http {
server {
listen 80;
server_name console.chubao.io ~^(?<bucket>.+)\.console\.chubao\.io$;
server_name console.chubao.io;
charset utf-8;
location / {
proxy_pass http://192.168.0.50:80;
proxy_pass http://consoles;
proxy_http_version 1.1;
proxy_set_header Host $http_host;