Hi

I'm addressing the optimal approach to reconciling fusebox bad circuits, 
fusebox bad fuse actions, and non-fusebox 404's. (i.e. that they all return the 
custom configured 404 page with an http status of 404 to the browser).

I realise that to "us" an invalid circuit  is a syntax error, but browsers, 
users and webbots don't really make that distinction. The URL either points to 
a resource on the server or it doesn't. If it doesn't then it expects a 404. We 
also need to be able to control the status codes for certain URLs (e.g. gone 
away, etc).

You can see the issue on the Active4D demo:

http://127.0.0.1/realms/main    = Status 200
http://127.0.0.1/realms/ma              = Status 500 + Error page
http://127.0.0.1/real                   = Status 500 + Error page

Whereas:

http://www.w3.org/standards/webarch     = Status = 200
http://www.w3.org/standards/weba                = Status = 404 + Resource not 
found page
http://www.w3.org/stand                         = Status = 404 + Resource not 
found page

EXAMPLE SOLUTION: BAD FUSEACTIONS (Dealt with in switches)

I'm currently calling throw(kMissingFuseactionError) in the else case of the 
switch, then having the "error=myHandler.a4d"  (from Active4D.ini) page filter 
certain throw codes and call the 404 page instead of reporting a syntax error 
to the user. (This also works for bad circuit errors thrown by the fusebox core 
- they get served as 404s).

However, I'd like to use "set response status(404)" in the fusebox switches for 
bad fuseactions because:

a) it seems the more natural way
b) I notice that Active4D not only sets the response status but also actually 
serves the 404 page
c) fusebox seems to continue to function and "wrap" the 404 page with the top 
level layout (i.e. the site template)
d) you don't get a load of syntax errors being reported in the Active4D error 
log

Doing this works, but I have the following issues:

[1] - I still have to trap the kInvalidCircuitError thrown by fusebox.core, so 
I still need to retain my syntax error handler and filter the values returned 
by "get throw code" to determine which ones should end up as a 404

[2] -  following on from [1], if I then call set response status(404) in the 
syntax error handler, it doesn't behave the same as if I called it in a regular 
page. i.e. it doesn't seem to invoke the 404 page, in fact an empty response is 
served in my case

I feel like I need a table showing all the status codes (or ranges) and what 
will happen when you call them., i.e. is Active4D going to something in 
addition to setting the response status such as serve the error_http page etc. 
I also need to know if the behaviour differs when "set response status" called 
in either of the "error_http" or "error" pages.

At the moment, using the "get throw code" and filtering the error codes to 
invoke 404s seems the most consistent approach. We end up with syntax errors in 
the Active4D log but that's ok - the user doesn't see it.

If I'm missing a better way of doing this using "set response status" that can 
do the job, I'd appreciate having it pointed out to me.

Many thanks

Peter

_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/

Reply via email to