From 2c03f084e32a05e70ada856bcbaf1f9460c6596f Mon Sep 17 00:00:00 2001 From: SaintLoong Date: Mon, 25 May 2020 11:06:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=82=E6=95=B0pathStyleAccess=20=E9=87=87=E7=94=A8=E9=9D=9E?= =?UTF-8?q?nginx=E4=BD=86=E6=83=B3=E4=BB=A3=E7=90=86=E6=88=96=E8=80=85AWS?= =?UTF-8?q?=20S3=20=E9=85=8D=E7=BD=AE=E6=88=90true=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BA=91=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=88=90false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/pig4cloud/pigx/common/oss/OssProperties.java | 10 ++++++++++ .../pig4cloud/pigx/common/oss/service/OssTemplate.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java index a5a37f930..3c15d286f 100755 --- a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java +++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java @@ -29,6 +29,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * oss: * enable: true * endpoint: http://127.0.0.1:9000 + * # pathStyleAccess 采用非nginx但想代理或者AWS S3 配置成true,支持第三方云存储配置成false + * pathStyleAccess: false * access-key: lengleng * secret-key: lengleng * bucket-name: lengleng @@ -50,6 +52,14 @@ public class OssProperties { */ private String customDomain; + /** + * true path-style + * nginx 反向代理和S3默认支持 pathStyle {http://endpoint/bucketname} + * false supports virtual-hosted-style 阿里云等需要配置为 + * virtual-hosted-style 模式{http://bucketname.endpoint} + */ + private Boolean pathStyleAccess; + /** * 应用ID */ diff --git a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java index d06526b36..72ffbdc3e 100755 --- a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java +++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java @@ -212,7 +212,7 @@ public class OssTemplate implements InitializingBean { .withClientConfiguration(clientConfiguration) .withCredentials(awsCredentialsProvider) .disableChunkedEncoding() - .withPathStyleAccessEnabled(false) + .withPathStyleAccessEnabled(ossProperties.getPathStyleAccess()) .build(); } } From e4922681a7291db4d0efaadec0b1979235c5609a Mon Sep 17 00:00:00 2001 From: SaintLoong Date: Mon, 25 May 2020 11:11:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?pathStyleAccess=20=E9=87=87=E7=94=A8nginx?= =?UTF-8?q?=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=E6=88=96=E8=80=85AWS=20S3?= =?UTF-8?q?=20=E9=85=8D=E7=BD=AE=E6=88=90true=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BA=91=E5=AD=98=E5=82=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=88=90false=20=E6=96=87=E6=A1=88=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/pig4cloud/pigx/common/oss/OssProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java index 3c15d286f..ee1700769 100755 --- a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java +++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java @@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * oss: * enable: true * endpoint: http://127.0.0.1:9000 - * # pathStyleAccess 采用非nginx但想代理或者AWS S3 配置成true,支持第三方云存储配置成false + * # pathStyleAccess 采用nginx反向代理或者AWS S3 配置成true,支持第三方云存储配置成false * pathStyleAccess: false * access-key: lengleng * secret-key: lengleng