How to Use Confluence to Serve Static Content

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。

このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

This is out of the scope of Atlassian support

Sometimes, it would be handy to use Confluence to serve static content.

Confluence relies on Apache Tomcat as the application server. Tomcat will serve any files which are in its root directory. In Confluence, this root directory is in <CONFLUENCE_INSTALL>/confluence/.

Serving Static Content Outside Confluence

Important - Bug Report

In order for below instructions to work, as reported in CONFSERVER-53166 - Getting issue details... STATUS , we do need to either inject custom HTML options in the code header or will need to place the code in a different location. Prior proceeding with below steps, please, check the above mentioned bug. 


Any file you place in <CONFLUENCE_INSTALL>/confluence/ will be served as an independent file and Confluence's style will not apply to it. This can be useful to:

  • Serve static HTML pages.
  • Store content (CSS, JavaScript, images,...) you want to reference or link from other Confluence pages (or even other sites).
  • Add files you want end users to download without the size limitations of Confluence.
  • Place your robots.txt to set rules for the search engines.

Accessing the content is easy. If you save a file in the location <CONFLUENCE_INSTALL>/confluence/myfile.html you should be able to access it in the URL http://<confluence-url>/myfile.html. HTML files will be rendered. Other file types will be displayed as plain text or downloaded depending on your browser. Modern browsers are normally able to reproduce media content (audio, video, pdf files) in the browser. You can also create your own folders to organize your files. In this case you will need to add the directory name to the URL to access the file (i.e.: http://<confluence-url>/mydir/myfile.html).

Confluence session and permissions do not apply to such static files, and the files would be available via URL without any login requirement. Please also make sure that your web.xml file does not have a filter to disable .html files from being displayed. This is not an issue with the default configuration in Confluence 5.9+, but this issue occurs in previous versions and instances with Tomcat customisations.

Creating shorter URLs for certain pages

As Tomcat serves HTML, we can use HTML to redirect to a particular Confluence page using a shorter URL. This functionality is similar to the tiny links described in Linking to Confluence pages from other websites, but with two main advantages:

  • The link will not depend on the page id, so you can avoid running into  CONF-27049 - Getting issue details... STATUS .
  • You can give the link a meaningful name.

As an example, imagine we have a Confluence space called Support (space key is SUP) and we want to give the home page of the space (http://my.confluence.com/display/SUP/Support+Home) a URL that is easier to remember (e.g., http://my.confluence.com/support). To accomplish this we would:

  1. Create a file called support in <CONFLUENCE_INSTALL>/confluence/.
  2. Add the following HTML to the file:

    <html>
       <head>
          <meta http-equiv="refresh" content="0;URL=http://my.confluence.com/display/SUP/Support+Home">
       </head>
       <body>
       </body>
    </html>

After this, every request to  http://my.confluence.com/support will be redirected to  http://my.confluence.com/display/SUP/Support+Home.

Any change to the title of the page will need to be manually modified in the file containing the HTML for the redirection.

最終更新日: 2024 年 12 月 18 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.