Skip to main content

Setting Up Public Hosting

Setting up Public Hosting on Files.com gives you precise control over how files are shared publicly, from configuring custom URLs to securing access with passwords and optimizing how content is displayed or downloaded. This article walks through the setup process, URL formatting, optional password protection, and key behaviors to be aware of when making content available to external users.

Enabling Public Hosting (Web Hosting) on your Site

Public Hosting is specific to a folder, which means you can configure it through the folder settings. You must be a site administrator or have admin rights for the relevant folder.

When you activate Public Hosting (Web Hosting) mode for a folder, you can specify the URL in the Serve files and sub-folders publicly at the following URL setting. The value can be anything that does not contain reserved, unsafe, or excluded characters as defined by RFC 1738External LinkThis link leads to an external website and will open in a new tab. Space characters are permissible and will be handled appropriately by most web browsers but will be encoded in the URL. The value must also be unique among your publicly served folders; you cannot save a value that duplicates another Public Hosting folder setting.

While Public Hosting can be used to provide easy public access to many different files, further optimizations may be needed if you are using the feature for delivering large amounts of static data such as multimedia files containing images and video content. Files.com does not offer capabilities often found in CDN (Content Delivery Network) technologies, hence you should consider deploying CDN technologies in conjunction with Files.com Public Hosting which specialize in optimizing the experience and speed up content delivery for such scenarios.

Configuring URL Keys

Strategies for choosing a URL value for your folder vary with the mission your new web server will fulfill. For example: if your folder's content is intended to be freely available to the public anywhere or is serving content embedded in one of your websites, you might choose a "friendly" or descriptive URL that reflects the type of contents, such as "forms".

Alternatively, if your folder's content is intended to be publicly available but very difficult to find without specific communication from your team, you can take a "security by obscurity" approach with a URL that resembles a token, such as sh4g7f3gf9xz39h-3hgtr4d or any link that no one could reasonably guess without being provided the link directly.

How to Calculate File URLs

Our customers occasionally ask how to list all of the URLs for a file in a folder with Public Hosting enabled, such as when they're designing a data feed to be consumed by an automated system.

Each hosting URL looks something like this:

https://subdomain.hosted-by-files.com/key /relative/path/to/filename.ext

This breaks down into the following parts:

  1. The protocol prefix. This is always https://
  2. Your custom subdomain
  3. The public hosting domain. This is always hosted-by-files.com
  4. The key assigned to the hosted folder
  5. Any subfolders within your hosted folder. If your file is directly in the hosted folder, skip this.
  6. Your file's name and extension.

To create your final URL, combine all of those parts without any spaces, keeping in mind that you may need to URL-encode the sub-folder and file names. To create valid URLs, any character in a folder or file name that is not a letter or number used needs to be encoded. For example, a space character (" ") in a file or folder name needs to be encoded as %20 in your URL. This process is also known as percent-encodingExternal LinkThis link leads to an external website and will open in a new tab.

Including Passwords in Calculated URLs

If you have enabled Password Protection for your hosted folder, you can create URLs that include the username and password. This is helpful when non-interactive systems, such as a curl, need to access a password-protected item. You'll follow similar steps to what's listed above, but your URL will have this format:

https://username:password@subdomain.hosted-by-files.com/key /path/to/filename.ext

This breaks down into the following parts:

  1. The protocol prefix. This is always https://
  2. The username for your password protection, followed by a colon (":")
  3. The password you defined, followed by the at-sign ("@")
  4. Your custom subdomain
  5. The public hosting domain. This is always hosted-by-files.com
  6. The key assigned to the hosted folder
  7. Any subfolders within your hosted folder. If your file is directly in the hosted folder, skip this.
  8. Your file's name and extension.

If you include characters other than letters and numbers in your password, the password must be percent-encoded, but do not encode the colon (":") or the at-sign ("@") that separate the credentials from the rest of your URL.

Index Pages

Enable Index Pages on your Public Hosted folders to show public listings of the folder contents, including subfolders. This is very useful if your web site visitors don't always know the full path to files they need, or if you do not include an HTML document with a table of links to other files.

When you don't enable the index pages for your Publicly Hosted folder, only links to files within the folder or its subfolders will work. Any attempt to access a folder directly through the public hosting link will fail. If you add an HTML file with your own custom index listing, it will only be served when visitors access its file directly, not when they to access the folder.

Password Protection

You may secure your Public Hosted folders with a single username and password, which is collected via HTTP Basic authentication. This looks like a popup dialog in the browser used by your visitors. You can include the username and password directly in the URL for use with curl and other non-interactive tools.

This password protection requires that you set a single username and password for the entire folder, which is used by everyone accessing the public URL. If you need to create multiple usernames and passwords, we recommend that you create these as full users on your site.

Your site's rules for Password restrictions are applied to public hosting passwords by default. Site administrators may disable this feature with the Apply password rules to shares, inboxes, and publicly served folders setting.

Default Download Behavior

By default, Public Hosting does not set a Content-Disposition header on hosted files. This means that when someone clicks on a publicly shared link, the browser determines how to handle the file based on its default behavior and the file's MIME typeExternal LinkThis link leads to an external website and will open in a new tab.

Files that will usually be opened directly in the browser include image files (like .jpg, .png, .gif), text files (such as .txt, .xml, .json), and PDFs (.pdf). Audio or video files (.aac, .mp3, .mp4, .wav , etc.) will usually be opened in the browser, but might not automatically start playing; this depends on the type of browser you are using.

Other files that require execution, such as .zip, .xlsx, .docx, and .exe will generally be downloaded, as most browsers do not render them directly. Javascript files (.js) are treated as text files - they are displayed but not executed.

Because Files.com does not override the browser’s default behavior with a Content-Disposition: attachment header, you can expect files to open or download based on how your browser handles the given file type.

In order to download files that would normally open within the browser, you can can use the "Save as" command once the file is opened. Right-clicking on links in most browsers will provide a context-menu that allows you to download the contents of a link.

Force Download Option

If you prefer files to always be downloaded rather than opened in the browser, you can enable the Force download of files setting for your Public Hosting folder. After you enable the setting, Files.com will apply a Content-Disposition: attachment header to all files, instructing the browser to download the file instead of opening it.

Disabling Public Hosting (Web Hosting) on a Folder

A site administrator or a user with admin rights to a folder can disable the public hosting at any time. As soon as the setting is updated, your files will no longer be accessible at the previous URL.

Get Instant Access to Files.com

The button below will take you to our Free Trial signup page. Click on the white "Start My Free Trial" button, then fill out the short form on the next page. Your account will be activated instantly. You can dive in and start yourself or let us help. The choice is yours.

Start My Free Trial