Need Apache to return multiple error doc

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Apache to return multiple error doc

alchemist vk
Hi all,
  I have a requirement where I need send different error docs for same error code depending upon specific error returned by application..
For example, if application returns 400,it means error may be due to non availability of query param or url doesn't have mandatory fields etc,and depending upon this exact error, I need to send proper error doc with exact error.. pls let me know how to achieve this..

PS: I have one error doc which says query param not available and another error doc which says non availability of the mandatory fields in URL, so how to differentiate and send specific error depending upon single error return code 400..

Thanks in advance,
With regards,
Venkatesh
Reply | Threaded
Open this post in threaded view
|

Re: Need Apache to return multiple error doc

Richard

> Date: Thursday, July 11, 2019 11:48:38 +0530
> From: alchemist vk <[hidden email]>
>
> Hi all,
>   I have a requirement where I need send different error docs for
> same error code depending upon specific error returned by
> application.. For example, if application returns 400,it means
> error may be due to non availability of query param or url doesn't
> have mandatory fields etc,and depending upon this exact error, I
> need to send proper error doc with exact error.. pls let me know
> how to achieve this..
>
> PS: I have one error doc which says query param not available and
> another error doc which says non availability of the mandatory
> fields in URL, so how to differentiate and send specific error
> depending upon single error return code 400..
>

You can point the ErrorDocument reference for a return code to a
script, rather than a static page. You can then use the script to
gather other available information (e.g., the referrer) to determine
the cause of the error and generate/serve an appropriate error
message.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Need Apache to return multiple error doc

alchemist vk
Thanks Richard for suggestion.
I will surely try on working out this. 

Thanks again for your time and help.

With Regards,
Venkatesh

On Fri, Jul 12, 2019 at 7:47 PM Richard <[hidden email]> wrote:

> Date: Thursday, July 11, 2019 11:48:38 +0530
> From: alchemist vk <[hidden email]>
>
> Hi all,
>   I have a requirement where I need send different error docs for
> same error code depending upon specific error returned by
> application.. For example, if application returns 400,it means
> error may be due to non availability of query param or url doesn't
> have mandatory fields etc,and depending upon this exact error, I
> need to send proper error doc with exact error.. pls let me know
> how to achieve this..
>
> PS: I have one error doc which says query param not available and
> another error doc which says non availability of the mandatory
> fields in URL, so how to differentiate and send specific error
> depending upon single error return code 400..
>

You can point the ErrorDocument reference for a return code to a
script, rather than a static page. You can then use the script to
gather other available information (e.g., the referrer) to determine
the cause of the error and generate/serve an appropriate error
message.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Need Apache to return multiple error doc

alchemist vk
Richard/All,
  I am trying to implement what you suggested.. But somehow its not working and unable to restart apache after making my changes.
  If possible, can you provide one short example code snippet .

Thanks in advance,
Venkatesh

On Fri, Jul 12, 2019 at 10:41 PM alchemist vk <[hidden email]> wrote:
Thanks Richard for suggestion.
I will surely try on working out this. 

Thanks again for your time and help.

With Regards,
Venkatesh

On Fri, Jul 12, 2019 at 7:47 PM Richard <[hidden email]> wrote:

> Date: Thursday, July 11, 2019 11:48:38 +0530
> From: alchemist vk <[hidden email]>
>
> Hi all,
>   I have a requirement where I need send different error docs for
> same error code depending upon specific error returned by
> application.. For example, if application returns 400,it means
> error may be due to non availability of query param or url doesn't
> have mandatory fields etc,and depending upon this exact error, I
> need to send proper error doc with exact error.. pls let me know
> how to achieve this..
>
> PS: I have one error doc which says query param not available and
> another error doc which says non availability of the mandatory
> fields in URL, so how to differentiate and send specific error
> depending upon single error return code 400..
>

You can point the ErrorDocument reference for a return code to a
script, rather than a static page. You can then use the script to
gather other available information (e.g., the referrer) to determine
the cause of the error and generate/serve an appropriate error
message.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Need Apache to return multiple error doc

Richard
In reply to this post by alchemist vk


> Date: Saturday, July 13, 2019 16:11:12 +0530
> From: alchemist vk <[hidden email]>
>
> Richard/All,
>   I am trying to implement what you suggested.. But somehow its not
> working and unable to restart apache after making my changes.
>   If possible, can you provide one short example code snippet .
>

Changing what an error return code points to should not effect your
server's ability to restart (even if there are errors in the
ErrorDocument itself). Please provide the ErrorDocument lines from
your apache config as well as the message you get when you try to
restart the server.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]