How to prevent 404 pages from redirecting unauthenticated users to the login screen

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Purpose

If anonymous access is not enabled in your site (people need to be logged in to use Confluence), unauthenticated users will always be redirected to the login screen, even if the URL they've tried to access does not exist. We only show a 404 page not found page if the user is logged in.

There are a few rare situations where you may want to display a 404 page not found page, without requiring the user to be logged in, for example if you have an integration or third-party plugin that relies on displaying the 404 page.

Solution

In this situation you can specify particular URLs to be exempt from this behaviour. Note that you can't exempt page or blog URLs (/display/SPACEKEY/page+title). 

This is available in Confluence 7.5.2 and later.

To exempt particular URLs:

  1. Create a file called 404-login-exemption.properties.
  2. Add the URL paths to be exempted as follows. You don't need to include your base URL or context path. Add new lines if you want to exempt multiple URLs. 

    fourohfour.allow.url.without.login=/mypath
    fourohfour.allow.url.without.login=/plugins/servlet/myplugin
  3. Save the file, and place it in the <home-directory>/shared-home/config directory. 
    If you run Confluence in a cluster, place it in the <shared-home>/config directory. 

  4. Restart Confluence.

You need to restart Confluence for any changes to this file to take effect. 


Last modified on Jun 22, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.