I belive the documentation is incomplete in this area.
I am looking into it.
Could you provide your app server configuration details and how you upgraded it 
from 6.x ? (did you copy it exactly, recreate it, use package manager ?)

In particular
Port
rewriter URL
error handler url
Authentication type (basic/app-level etc)
default error format
Database
Modules DB
Modules Root



There is a core change in 8.0 where some types of HTTP level validation are now 
always generated by the core server where in 7.x they were passed to the user 
defined error handler.
Specifically any 'HTTP protocol errors', HTTP validation or authentication 
errors that occur before the request is sufficiently processed to determine if 
the user is allowed to execute the rewriter are now handled internally 
according to the precedence documented.

Errors thrown during user error handler execution are similarly handled.


Its not clear which is the case for your example.
Also the setting for default error format only applies to core server generated 
errors.  Application generated errors can get the value of the default error 
format and choose to generate an appropriate format result or not.

If your using the declarative (XML) rewriter you can set the in-effect error 
format in the rewriter (overriding the default format).

There are several trace events that report on the resolution and handling of 
error messages as they occur.   If you enable tracing and add these events then 
in ErrorLog.txt you will get a great deal of detail (more than you may want in 
a production system).

Error and format handling
     <event-id>AppServer ErrorHandler</event-id>
      <event-id>HTTPRequest ErrorFormat</event-id>


Rewriter details
      <event-id>AppRequest RewriteDetails</event-id>
      <event-id>AppRequest Rewrite</event-id>
      <event-id>AppRequest XML Rewriter</event-id>
      <event-id>Declarative Rewriter</event-id>
      <event-id>URL Rewrite</event-id>
      <event-id>Rewriter Evaluator</event-id>
      <event-id>Rewriter Evaluator Verbose</event-id>
      <event-id>Rewriter Invoke</event-id>
      <event-id>Rewriter Parser</event-id>
      <event-id>Rewriter Result</event-id>

Authentication
      <event-id>AppRequest Authentication Details</event-id>

-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

From: [email protected] 
[mailto:[email protected]] On Behalf Of Danny Sokolsky
Sent: Tuesday, July 28, 2015 2:14 PM
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] ML 8 Error Handler Non-Execution | 
Unauthorized User

Have you looked at your rewriter too?  Maybe the 401 is for the rewriter, not 
the error handler?

Another clue might come from the AccessLog for that app server.

-Danny

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Rahul Gupta
Sent: Tuesday, July 28, 2015 9:55 AM
To: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] ML 8 Error Handler Non-Execution | 
Unauthorized User

Hi,

I am currently migrating my ML 6.0-5.3 code to ML 8.0-3 and I found that 
error-handler for the App-server is not being executed when an unauthorized 
user logs in. I did some research and came to this link:
https://docs.marklogic.com/guide/app-dev/appserver-control#id_84264

But this link has no change as compared to ML 6 documentation and it was doing 
custom error handling for an unauthorized-user.
https://docs.marklogic.com/6.0/guide/app-dev/appserver-control#id_84264

[cid:[email protected]]

And in error-handler.xqy, it is written like as follows:

let $error as element(e:error) :=
      if ( fn:exists($error:errors) ) then
        local:handle-thrown-exception()
      else
        local:handle-general-error()

Also, the app-server default user is assigned with admin role and default error 
format in ML 8 as "xml" tried using "html, json, compatible". Hence it has the 
execute permissions too. Still Not working... Can anyone please suggest how to 
throw custom message for an unauthorized user from the error handler mechanism.

Currently I am getting is:

<error-response xmlns='http://marklogic.com/xdmp/error'>
     <status-code>401</status-code>
     <status>Unauthorized</status>
     <message>401 Unauthorized</message>
</error-response>

Thanks,
Rahul
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to