Fixing Apache HTTPD Configuration for Blocking Specific Headers and Custom 403 Error Page

  Kiến thức lập trình

I’m facing an issue in Apache httpd. In the littpd.conf. Inside the rewrite.mod I am blocking requests which have these 3 headers

X-HTTP-METHOD

X-HTTP-Method-Override

X-METHOD-OVERRIDE

And the response code to be 403 and reditecting it to a custom 403 error page. Providng the code the below:

#Block requests with X-HTTP-METHOD header RewriteCond %{HTTP:X-HTTP-METHOD]!=”” RewriteRule ^ – [F]

#Block requests with X-HTTP-Method-Dverride header RewriteCond %(HTTP:X-HTTP-Method-Override) !=””

RewriteRule ^ – [F]

#Block requests with X-METHOD-OVERRIDE header RewriteCond %{HTTP:X-METHOD-OVERRIDE) 1-

RewriteRule ^ – [F]

But, I am getting the below message in the front end

You don’t have permission to access this resource.

error was encountered while trying to use an Eccoclocument to handle the request.

Additionally, a 403 Forbidden

1 AHB0124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternal Recursion to increase the limit if necessary. Use LogLevel debug to get a backtrace, referer: is provided here

And in the error logs of httpd

How to fix this issue?

I added rewritecond and rewriterule in rewrite mod tag. I was expecting 403 custom error page to come up but. I was getting a permission denied error for accessing the resources.

My guess is that the https isn’t able to take the file path. But for other 403 errors the custom error page is coming properly

New contributor

Deepak B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT