Expand my Community achievements bar.

SOLVED

Issue in Custom Error Handler

Avatar

Level 3

Hi Team,

We are implementing a custom error handler page, so we have added in dispatcher file ErrorDocument 404 to custom handler page.

 

when we are calling to any page, which are not there in Author, from dispatcher then its giving the custom error page but while calling "/crx/explorer/index.jsp.css" , its not giving custom error handler page.

Can someone please help here

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @skumari - 

 

You can go to the dispatcher.any file => Locate the /filter section

Later you can make the changes like below : 

/filter
{
    /filter_rules
    {
        # Rule to handle /crx/explorer/index.jsp.css
        /0001
        {
            /type "allow"
            /glob "*index.jsp.css"
            /redirect "https://example.com/custom-error-handler"
        }

        # Additional rules...

        # Default rule for handling other requests
        /default
        {
            /type "deny"
            /redirect "https://example.com/custom-error-handler"
        }
    }
}

 

Regards,

Tanika

View solution in original post

7 Replies

Avatar

Community Advisor

@skumari @ What's the use case here? What are you achieving here by hitting "/crx/explorer/index.jsp.css" ?

 

Can you elaborate as to why/how. Thanks,

Bilal

Avatar

Level 3

Hi @bilal_ahmad 

I am getting below response while hitting the from Pub/Dis, which shouldn't be the case. I should have get the custom error page with 404 response code.

skumari_0-1687418147641.png

 

Avatar

Community Advisor

Hello @skumari - 

 

  • When configuring a custom error handler page in dispatcher.any, the ErrorDocument directive is typically used to specify the custom page for handling specific HTTP error codes, such as 404 (Not Found) errors. However, the Dispatcher may not handle requests for certain resources, such as /crx/explorer/index.jsp.css, as it bypasses the configured error handling.
  • To address this issue, you can modify your dispatcher configuration to handle such requests and redirect them to your custom error handler page. Here's how you can do it : 

Go to dispatcher.any file => locate the "rules" section => Add a new rule to handle the specific request for /crx/explorer/index.jsp.css

 
/crx/explorer/index.jsp.css
{
/redirect "http://your-custom-error-page-url"
}

 Restart dispatcher and it should be able to solve the problem.

 

Regards,

Tanika 

 

Avatar

Level 3

Hi @Tanika02 

Do i need to put the above rule in this section(/rules from screenshot)?

skumari_0-1687429433299.png

 

Avatar

Correct answer by
Community Advisor

Hello @skumari - 

 

You can go to the dispatcher.any file => Locate the /filter section

Later you can make the changes like below : 

/filter
{
    /filter_rules
    {
        # Rule to handle /crx/explorer/index.jsp.css
        /0001
        {
            /type "allow"
            /glob "*index.jsp.css"
            /redirect "https://example.com/custom-error-handler"
        }

        # Additional rules...

        # Default rule for handling other requests
        /default
        {
            /type "deny"
            /redirect "https://example.com/custom-error-handler"
        }
    }
}

 

Regards,

Tanika

Avatar

Level 3

Hi @Tanika02 

My custom error page path is "/content/bookpedia/us/en/error" so will this the correct way to apply the rule?

# Rule to handle /crx/explorer/index.jsp.css
/0001
{
/type "allow"
/glob "*index.jsp.css"
/redirect "/content/bookpedia/us/en/errors"
}