anchor.diff:          "&Signature=", url_encode(Enc),
           "&Expires=", Expires
       ]),
  -    Region = to_bin(maps:get(region, Config)),
  -    Service = to_bin(maps:get(service, Config)),
  -    Host = <<Service/binary, $., Region/binary, ".amazonaws.com">>,
  -    {Method, <<Host/binary, Path/binary, Qs/binary>>}.
  +    {_Region, _Service, _Host, Url} = get_service(Config),
  +    {Method, <<Url/binary, Path/binary, Qs/binary>>}.
   
   
   
   %% ===================================================================
   %% Internal
   %% ===================================================================
  +
  +get_service(Config) ->
  +    Region = to_bin(maps:get(region, Config, ?DEFAULT_REGION)),
  +    Service = to_bin(maps:get(service, Config, s3)),
  +    Scheme = to_bin(maps:get(scheme, Config, <<"https">>)),
  +    DefPort = case Scheme of <<"http">> -> 80; <<"https">> -> 443 end,
  +    Port = to_bin(maps:get(port, Config, DefPort)),
  +    Host = case maps:find(host, Config) of
  +        {ok, ConfigHost} ->
  +            to_bin(ConfigHost);
  +        error ->
  +            <<Service/binary, $., Region/binary, ".amazonaws.com">>
  +    end,
  +    FullHost = <<Host/binary, $:, Port/binary>>,
  +    Url = <<Scheme/binary, "://", FullHost/binary>>,
  +    {Region, Service, FullHost, Url}.
   
   
   %% @private
  
positive.code: %% @private
  url_encode(Binary) when is_binary(Binary) ->
      url_encode(unicode:characters_to_list(Binary));
  
  url_encode(String) ->
      url_encode(String, []).
  
negative.code:     end,
      NormHeaders = [
          {nklib_util:to_lower(Name), to_bin(Value)}
          || {Name, Value} <- Headers3
      ],
      SortedHeaders = lists:keysort(1, NormHeaders),
      CanonicalHeaders = [[Name, $:, Value, $\n] || {Name, Value} <- SortedHeaders],
  