Repository navigation
The .htaccess file
Panopticon ships with a file called htaccess.txt. If you are using Apache 2.2 or later (preferably Apache 2.4) as your web server and you are accessing Panopticon over HTTP you should rename this file to .htaccess.
This .htaccess file enables the following optional, but very welcome, security and performance features:
- Disables listing the files of arbitrary subdirectories.
- Blocks access to internal directories with no web-accessible content e.g.
cache,tmp,vendor,ViewTemplatesand so on. - Sets up Content-Security-Policy, X-Frame-Options, X-XSS-Protection, and X-Content-Type HTTP headers to tighten the security of your Panopticon installation.
- Automatically compresses static media files with Brotli (preferred, if available), or Gzip.
- Disables the X-Powered-By and X-Content-Powered-By headers.
- Enables HSTS (the HTTP Strict-Transport-Security header) to force your installation be accessed over HTTPS.
- Disables the HTTP method TRACE which is not used by Panopticon and could be abused for Cross Site Tracking.
- Sets the default output character set to UTF-8 so that your browser can display pages correctly, even on misconfigured installations of PHP.
The included .htaccess content requires Apache's mod_rewrite module to be enabled. If this is not the case, you will be unable to access your installation. In this case, delete the .htaccess file.
The included .htaccess content is compatible with Apache 2.2, and Apache 2.4. It seems to be working fine with Litespeed. However, it will not work correctly with OpenLitespeed. Unlike Litespeed proper, OpenLitespeed does NOT support the full range of .htaccess directives, leading to problems. If you have a problem using Panopticon with OpenLitespeed delete the .htaccess file, or switch to either Apache (free) or Litespeed (commercial, for a fee).
The included .htaccess content is written with the assumption that your Panopticon installation is accessible over HTTPS. This is the only recommended setup for security reasons. If you have some fringe use case where this is not the case, e.g. you use a standalone SSL/TLS Terminator in front of Apache, you will have to edit the file manually. Please do not ask for assistance; if you have such a use case you should be more than comfortable editing a .htaccess file.
The .htaccess files are NOT supported by NginX and Microsoft Internet Information Services (ISS) web servers. We do not have plans on porting our .htaccess content to NginX and/or IIS. Users of these servers need to be technically adept, or work with such a person, therefore they can configure their server themselves.
The JSON API and the MCP Server both authenticate with Bearer tokens (Authorization: Bearer …) and share the same token-authentication code. For either to work you must ensure the Authorization HTTP header is forwarded to PHP. Many web server / PHP SAPI combinations strip this header by default, which makes every request fail with an HTTP 401 even when the token is correct. This is the single most common cause of "the token is right but I keep getting 401" reports.
-
Apache + PHP-FPM (or CGI/FastCGI). The shipped
.htaccessalready takes care of this through theSetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1directive inside themod_rewriteblock. The alternative isCGIPassAuth On, available in Apache 2.4.13 and later. - Apache + mod_php. No action needed; the header is passed through automatically.
-
NginX + PHP-FPM. Add
fastcgi_pass_header Authorization;to yourlocationblock that handles PHP. Alternatively, explicitly set the FastCGI parameter:fastcgi_param HTTP_AUTHORIZATION $http_authorization;. -
IIS + PHP (FastCGI). Behaviour varies by version and configuration; some setups forward
Authorizationand some strip it. If Bearer tokens fail, add a URL Rewrite rule toweb.configthat copies the header into a server variable PHP can see (you must first listHTTP_AUTHORIZATIONunder URL Rewrite → View Server Variables to allow setting it):<rule name="Forward Authorization header" stopProcessing="false"> <match url=".*" /> <serverVariables> <set name="HTTP_AUTHORIZATION" value="{HTTP_AUTHORIZATION}" /> </serverVariables> <action type="None" /> </rule>
If you do not use the full shipped .htaccess (for example, you maintain your own), the two things Panopticon's API and MCP server need are the Authorization header forwarding and — only if you want the short /api/… and /mcp URLs — the clean-URL rewrites:
<IfModule mod_setenvif.c>
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</IfModule>
## …or, on Apache 2.4.13 and later, use "CGIPassAuth On" instead of the SetEnvIf block above.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^api(/.*)?$ index.php/api$1 [L,QSA]
RewriteRule ^mcp(/.*)?$ index.php/mcp$1 [L,QSA]
</IfModule>Note
The clean-URL rewrites (and their Nginx/IIS equivalents) are optional. The https://…/index.php/api/v1/… and https://…/index.php/mcp forms always work, on any server, without any rewrite rule. On Nginx and IIS, using the index.php form is the simplest option — you then only need to sort out Authorization header forwarding, not URL rewriting.
If Bearer tokens unexpectedly return HTTP 401 responses, this header-stripping behaviour is the first thing to check. As a fallback, you can pass the token through the X-Panopticon-Token header or the _panopticon_token query parameter (URL-encode the token in that case — API tokens are Base64 and contain characters such as + that a URL otherwise mangles; note also that the query-parameter form leaks the token into access logs and Referer headers, so prefer Bearer in production).
Documentation Copyright ©2023–2025 Akeeba Ltd.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
You can also obtain a copy of the GNU Free Documentation License from the Free Software Foundation
- Overview pages
- Working with sites
- Site Overview
- Backup Management with Akeeba Backup Pro
- Security Management with Admin Tools Pro
- Core File Integrity Check
- Scheduled Update Summary
- Scheduled Action Summary
- Backup Tasks
- Scanner Tasks
- System Configuration
- Managing Sites
- Mail templates
- Web Push Notifications
- Legal Policies
- Users and Groups
- Tasks
- Log files
- Update Panopticon
- Database Backups
- Fixing your session save path
- The .htaccess file
- Advanced Customisation (user code)
- Plugins
- Custom CSS
- Custom Templates
- Advanced Permissions
- .env For Configuration
- API Overview
- Sites endpoints
- Stats & Site Status endpoints
- System configuration endpoints
- Tasks endpoints
- Self-update endpoints