Any suggestions on above query? On Wed, Aug 11, 2021 at 2:21 PM alchemist vk <alchemist...@gmail.com> wrote:
> Hi All, > As per https://httpd.apache.org/docs/2.4/rewrite/flags.html, [R] flag > can be used to redirect to new location, along with overwriting default 302 > status code. > I followed the same and with below configuration, > RewriteCond %{REQUEST_URI} ^/abcd > ErrorDocument 404 /test_error_404.json > RewriteRule ^.*$ - [R=404,L] > > *Expectation*: With above config, expecting apache to return response > status code as 404 and response body as content of test_error_404.json. > > *Observation*: > Apache is sending the response status code as 302 and also not sending the > content of test_error_404.json. > Below is the response. > < HTTP/1.1 302 Found > < Date: Wed, 11 Aug 2021 21:38:00 GMT > < Server: Apache > < X-Frame-Options: DENY > < Location: https://{ip}/test_error_404.json > < Content-Length: 252 > < Content-Type: text/html; charset=iso-8859-1 > < > <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> > <html><head> > <title>302 Found</title> > </head><body> > <h1>Found</h1> > <p>The document has moved <a href="https:// > {ip}/test_error_404.json">here</a>.</p> > </body></html> > * Closing connection #0 > > Pls let me know, how to send the response code as 404 along with content > of test_error_404.json as response body. > > Thanks in advance >