litespeedtech / litespeedtech/openlitespeed

Server level custom error pages not working.

Open
#460 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.5k
Forks
233
Avg merge
2d 19h
Merged PRs (30d)
5

Description

Hi :)
In my setup, I want to show a custom error page when mod security (owasp) throws an error like 403.
I use openlitespeed.

How can I make this happen?
I tried putting custome error pages on the server config level (httpd_conf.conf) with no success like this:

context /error.html {
    location  /var/www/vhosts/localhost/html/error.html
    allowBrowse           1
    indexFiles error.html
}
include /usr/local/lsws/conf/custom_error_pages.conf

I tried also putting the custom error pages on vhost level, no success...

I found that the 403 pages come out of httpsstatuscode.cpp https://github.com/litespeedtech/openlitespeed/blob/252f18c1c56fcd6ccbea17ddd9d27696470eed31/src/http/httpstatuscode.cpp#L207.

Please advise :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the server-level and virtual-host custom error-page configuration shown in the issue, then trace the 403 response in src/http/httpstatuscode.cpp around the referenced line. Determine why the configured page is not used for mod_security 403 responses; done means a configured custom page is served for that case at both supported configuration levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.