This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 800063c309 NIFI-14384 Added Force Path Style option to S3 Persistence 
Provider (#10331)
800063c309 is described below

commit 800063c30982fa2ddaaaac18756e8815225327be
Author: shubalex <[email protected]>
AuthorDate: Tue Nov 25 18:49:38 2025 +0300

    NIFI-14384 Added Force Path Style option to S3 Persistence Provider (#10331)
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../nifi-registry-docker/dockerhub/README.md        |  2 +-
 .../dockerhub/sh/update_bundle_provider.sh          |  1 +
 .../src/main/asciidoc/administration-guide.adoc     |  1 +
 .../src/main/resources/conf/providers.xml           |  5 +++++
 .../nifi-registry-aws-assembly/README.md            |  1 +
 .../registry/aws/S3BundlePersistenceProvider.java   | 21 +++++++++++++++++++++
 6 files changed, 30 insertions(+), 1 deletion(-)

diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/README.md 
b/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/README.md
index a60c167da6..7f7659aff9 100644
--- a/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/README.md
+++ b/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/README.md
@@ -197,4 +197,4 @@ The following, optional environment variables may be added 
to configure extensio
 | NIFI_REGISTRY_S3_ACCESS_KEY           | Access Key                          |
 | NIFI_REGISTRY_S3_SECRET_ACCESS_KEY    | Secret Access Key                   |
 | NIFI_REGISTRY_S3_ENDPOINT_URL         | Endpoint URL                        |
-
+| NIFI_REGISTRY_S3_FORCE_PATH_STYLE     | Force Path Style                    |
diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/sh/update_bundle_provider.sh
 
b/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/sh/update_bundle_provider.sh
index 27d5c940ac..e287aa4dee 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/sh/update_bundle_provider.sh
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-docker/dockerhub/sh/update_bundle_provider.sh
@@ -44,5 +44,6 @@ case ${NIFI_REGISTRY_BUNDLE_PROVIDER} in
         add_property "Access Key"            "${NIFI_REGISTRY_S3_ACCESS_KEY:-}"
         add_property "Secret Access Key"     
"${NIFI_REGISTRY_S3_SECRET_ACCESS_KEY:-}"
         add_property "Endpoint URL"          
"${NIFI_REGISTRY_S3_ENDPOINT_URL:-}"
+        add_property "Force Path Style"      
"${NIFI_REGISTRY_S3_FORCE_PATH_STYLE:-}"
         ;;
 esac
diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
 
b/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
index c91360ed38..d82cfd70d7 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/administration-guide.adoc
@@ -1600,6 +1600,7 @@ Qualified class name: 
`org.apache.nifi.registry.aws.S3BundlePersistenceProvider`
 |`Access Key`| The access key to use when using `STATIC` credentials provider.
 |`Secret Access Key`| The secret access key to use when using `STATIC` 
credentials provider.
 |`Endpoint URL`| An optional URL that overrides the default AWS S3 endpoint 
URL. Set this when using an AWS S3 API compatible service hosted at a different 
URL.
+|`Force Path Style`| Optional boolean value (`true`/`false`) that controls the 
URL style used for S3 requests. Defaults to `false`, which uses 
virtual-hosted-style URLs (e.g., 
`https://bucket-name.s3.region.amazonaws.com/key`). Set to `true` to use 
path-style URLs (e.g., `https://s3.region.amazonaws.com/bucket-name/key`). 
Typically required for S3-compatible storage systems like MinIO, Ceph, or other 
non-AWS implementations.
 |====
 
 == Event Hooks
diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/providers.xml
 
b/nifi-registry/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/providers.xml
index 70169b5248..d68fa67efb 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/providers.xml
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-resources/src/main/resources/conf/providers.xml
@@ -83,6 +83,10 @@
             - "Secret Access Key" - The secret access key to use when using 
STATIC credentials provider
             - "Endpoint URL" - An optional URL that overrides the default AWS 
S3 endpoint URL.
                  Set this when using an AWS S3 API compatible service hosted 
at a different URL.
+            - "Force Path Style" - Optional boolean value (true/false) that 
controls the URL style used for S3 requests.
+                 Defaults to false, which uses virtual-hosted-style URLs 
(e.g., https://bucket-name.s3.region.amazonaws.com/key).
+                 Set to true to use path-style URLs (e.g., 
https://s3.region.amazonaws.com/bucket-name/key).
+                 This is typically required for S3-compatible storage systems 
like MinIO, Ceph, or other non-AWS implementations.
      -->
     <!--
     <extensionBundlePersistenceProvider>
@@ -94,6 +98,7 @@
         <property name="Access Key"></property>
         <property name="Secret Access Key"></property>
         <property name="Endpoint URL"></property>
+        <property name="Force Path Style"></property>
     </extensionBundlePersistenceProvider>
     -->
 
diff --git 
a/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-assembly/README.md
 
b/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-assembly/README.md
index 84af605930..ddc9f67739 100644
--- 
a/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-assembly/README.md
+++ 
b/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-assembly/README.md
@@ -79,6 +79,7 @@ Uncomment the extensionBundlePersistenceProvider for S3:
     <property name="Access Key"></property>
     <property name="Secret Access Key"></property>
     <property name="Endpoint URL"></property>
+    <property name="Force Path Style"></property>
 </extensionBundlePersistenceProvider>
 -->
 ```
diff --git 
a/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java
 
b/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java
index 616c113008..1d2d17cf6f 100644
--- 
a/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java
+++ 
b/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java
@@ -65,6 +65,7 @@ public class S3BundlePersistenceProvider implements 
BundlePersistenceProvider {
     public static final String ACCESS_KEY_PROP = "Access Key";
     public static final String SECRET_ACCESS_KEY_PROP = "Secret Access Key";
     public static final String ENDPOINT_URL_PROP = "Endpoint URL";
+    public static final String FORCE_PATH_STYLE_PROP = "Force Path Style";
 
     public static final String NAR_EXTENSION = ".nar";
     public static final String CPP_EXTENSION = ".cpp";
@@ -102,10 +103,30 @@ public class S3BundlePersistenceProvider implements 
BundlePersistenceProvider {
             builder.endpointOverride(s3EndpointOverride);
         }
 
+        final boolean forcePathStyle = getForcePathStyle(configurationContext);
+        if (forcePathStyle) {
+            builder.forcePathStyle(forcePathStyle);
+        }
+
         return builder.build();
 
     }
 
+    private boolean getForcePathStyle(ProviderConfigurationContext 
configurationContext) {
+        final String forcePathStyleValue = 
configurationContext.getProperties().get(FORCE_PATH_STYLE_PROP);
+        if (StringUtils.isBlank(forcePathStyleValue)) {
+            LOGGER.debug("Force Path Style not specified, using default value: 
false");
+            return false;
+        }
+
+        try {
+            return Boolean.parseBoolean(forcePathStyleValue);
+        } catch (Exception e) {
+            LOGGER.warn("Invalid value for Force Path Style: '{}', using 
default value: false", forcePathStyleValue);
+            return false;
+        }
+    }
+
     private Region getRegion(final ProviderConfigurationContext 
configurationContext) {
         final String regionValue = 
configurationContext.getProperties().get(REGION_PROP);
         if (StringUtils.isBlank(regionValue)) {

Reply via email to