diff --git a/config/rootrc.in b/config/rootrc.in
index f29f5199325c052d639ff36e871908311908104a..bb6a35f061ee2d530bd9383fdffd31ad359e5300 100644
--- a/config/rootrc.in
+++ b/config/rootrc.in
@@ -723,10 +723,17 @@ Davix.UseOldClient: @useoldwebfile@
 # Sets the Amazon S3 authentication parameters
 # Region is optional - if provided, davix will use v4 signatures
 # Token is optional, and enables the use of STS temporary credentials
+#
+# Alternate is optional and takes a boolean value. If set to true, davix
+# will assume that the bucket name is in the path, not in the hostname.
+# Necessary because davix has to know the bucket name to calculate
+# the S3 signatures.
+#
 # Davix.S3.SecretKey: secret
 # Davix.S3.AccessKey: access
 # Davix.S3.Region: region
 # Davix.S3.Token: token
+# Davix.S3.Alternate: yes
 
 # NOTE: The authentication of TDavixFile/TDavixSystem can be influenced
 # through some well known environment variables:
diff --git a/net/davix/src/TDavixFile.cxx b/net/davix/src/TDavixFile.cxx
index bf50c9b24e69571e035db8e09ee562513735466e..0351b54b586ee600ea5661eeacaa4b646afc75b6 100644
--- a/net/davix/src/TDavixFile.cxx
+++ b/net/davix/src/TDavixFile.cxx
@@ -71,6 +71,7 @@ const char* s3_seckey_opt = "s3seckey=";
 const char* s3_acckey_opt = "s3acckey=";
 const char* s3_region_opt = "s3region=";
 const char* s3_token_opt = "s3token=";
+const char* s3_alternate_opt = "s3alternate=";
 const char* open_mode_read = "READ";
 const char* open_mode_create = "CREATE";
 const char* open_mode_new = "NEW";
@@ -92,6 +93,15 @@ bool isno(const char *str)
 
 }
 
+bool strToBool(const char *str, bool defvalue) {
+    if(!str) return defvalue;
+
+    if(strcmp(str, "n") == 0 || strcmp(str, "no") == 0  || strcmp(str, "0") == 0 || strcmp(str, "false") == 0) return false;
+    if(strcmp(str, "y") == 0 || strcmp(str, "yes") == 0 || strcmp(str, "1") == 0 || strcmp(str, "true") == 0)  return true;
+
+    return defvalue;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 
 int configure_open_flag(const std::string &str, int old_flag)
@@ -321,6 +331,20 @@ static void awsToken(...) {
    Warning("awsToken", "Unable to set AWS token, not supported by this version of davix");
 }
 
+// Identical SFINAE trick as above for setAwsAlternate
+template<typename TRequestParams = Davix::RequestParams>
+static auto awsAlternate(TRequestParams *parameters, bool option)
+  -> decltype(parameters->setAwsAlternate(option), void())
+{
+   if (gDebug > 1) Info("awsAlternate", "Setting S3 path-based bucket option (s3alternate)");
+   parameters->setAwsAlternate(option);
+}
+
+template<typename TRequestParams = Davix::RequestParams>
+static void awsAlternate(...) {
+   Warning("awsAlternate", "Unable to set AWS path-based bucket option (s3alternate), not supported by this version of davix");
+}
+
 void TDavixFileInternal::setAwsRegion(const std::string & region) {
    if(!region.empty()) {
       awsRegion(davixParam, region.c_str());
@@ -333,6 +357,11 @@ void TDavixFileInternal::setAwsToken(const std::string & token) {
    }
 }
 
+void TDavixFileInternal::setAwsAlternate(const bool & option) {
+   awsAlternate(davixParam, option);
+}
+
+
 void TDavixFileInternal::setS3Auth(const std::string &secret, const std::string &access,
                                    const std::string &region, const std::string &token)
 {
@@ -382,6 +411,10 @@ void TDavixFileInternal::parseConfig()
       if( (env_var = gEnv->GetValue("Davix.S3.Token", getenv("S3_TOKEN"))) != NULL) {
          setAwsToken(env_var);
       }
+      // need to set aws alternate?
+      if( (env_var = gEnv->GetValue("Davix.S3.Alternate", getenv("S3_ALTERNATE"))) != NULL) {
+         setAwsAlternate(strToBool(env_var, false));
+      }
    }
 
    env_var = gEnv->GetValue("Davix.GSI.GridMode", (const char *)"y");
@@ -429,6 +462,10 @@ void TDavixFileInternal::parseParams(Option_t *option)
       if (strncasecmp(it->c_str(), s3_token_opt, strlen(s3_token_opt)) == 0) {
          s3token = std::string(it->c_str() + strlen(s3_token_opt));
       }
+      // s3 alternate option
+      if (strncasecmp(it->c_str(), s3_alternate_opt, strlen(s3_alternate_opt)) == 0) {
+         setAwsAlternate(strToBool(it->c_str() + strlen(s3_alternate_opt), false));
+      }
       // open mods
       oflags = configure_open_flag(*it, oflags);
    }
diff --git a/net/davix/src/TDavixFileInternal.h b/net/davix/src/TDavixFileInternal.h
index 7f2a36aa047709315ba96fe74def92716a6f697d..873f91382a8873b915e10fe58b074c0596b125d3 100644
--- a/net/davix/src/TDavixFileInternal.h
+++ b/net/davix/src/TDavixFileInternal.h
@@ -100,6 +100,7 @@ private:
 
    void setAwsRegion(const std::string & region);
    void setAwsToken(const std::string & token);
+   void setAwsAlternate(const bool &option);
 
    void setS3Auth(const std::string & secret, const std::string & access,
                   const std::string & region, const std::string & token);