Atozed Forums
catch-all content-handler - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: catch-all content-handler (/thread-2479.html)



catch-all content-handler - JuergenS - 08-06-2021

Hi Alexandre,

I have 2 servers with URL registration, which are now displayed differently in the address bar of the browser:

https://Mydomain.com/URLBase1/
https://Mydomain.com/URLBase2

One URL has a slash at the end now, the other doesn't.
I think that has changed in version IW15.2.33.

I also installed a new catch-all content handler.

Unfortunately, the catch-all content handler now triggers immediately for the second URL without a slash at the end.


RE: catch-all content-handler - Alexandre Machado - 08-06-2021

How are you registering them?

Is URLBase2 registered as document or as path?


RE: catch-all content-handler - Alexandre Machado - 08-06-2021

I ran a quick test here and I can't reproduce the problem... The catch-all content handler check is the last check before returning 404, which means that if it doesn't trigger, most likely you will get a 404. What happens if you comment out the catch-all registration?


RE: catch-all content-handler - JuergenS - 08-07-2021

I am currently already using IW15.2.34.
To register, I simply set TIWServerController :: URLBase without a slash.
The problem also occurs without my catch-all content handler, in which case the Intraweb error message dialog is displayed.
If a URL is inserted into the address bar of a browser without a slash at the end, the slash is usually automatically appended, but not always.


RE: catch-all content-handler - Alexandre Machado - 08-07-2021

(08-07-2021, 08:00 AM)JuergenS Wrote: I am currently already using IW15.2.34.
To register, I simply set TIWServerController :: URLBase without a slash.
The problem also occurs without my catch-all content handler, in which case the Intraweb error message dialog is displayed.
If a URL is inserted into the address bar of a browser without a slash at the end, the slash is usually automatically appended, but not always.

So, I'm assuming that you are registering as

  THandlers->Add("", s, SomeHandler);  // where s == TIWServerController::URLBase (minus the end URL delimiter)

  THandlers->Add("", "*", TheCatchAllHandler);

Is that correct?

Regarding 

>> The problem also occurs without my catch-all content handler, in which case the Intraweb error message dialog is displayed

Are you referring to the standard error page with error code 404 (Not found)?

If my assumption is correct, looks that you are registering 2 conflicting handlers (i.e. both are pointing to the root of your web site.

I would try to register the first content handler to point to some specific *path* (please notice that the path is the first parameter and requires both URL delimiters):

  THandlers->Add(s, "", SomeHandler);  // where s == TIWServerController::URLBase (including start/end URL delimiters)

In this case I don't see why you would need a catch all content handler (once you have a URLBase)


RE: catch-all content-handler - JuergenS - 08-08-2021

You're right, I initialize the content handler this way and I also mean the standard error page with error code 404 (Not found).

I would like to capture the website scanning for nonexistent paths and files without changing the behavior of the server.
According to the version history of IW15.2.33, this seemed to me a useful way.

"Content Handlers: allow registration of a “catch-all” content handler for any path and document (should be registered with an asterisk, e.g., THandlers.Add(”, ‘*’, TMyContentHandler.Create). Instead of returning 404 for any unknown path you can, for instance, redirect the request to a valid page/form/content handler/etc. (See TContentRedirect examples)."

Maybe you can give me a hint how I can do that.

But still,

https://Mydomain.com/URLBase/
https://Mydomain.com/URLBase

both should work for each browser, also without any catch-all content-handler.


RE: catch-all content-handler - Alexandre Machado - 08-12-2021

I'll see if I can adapt our existing demo showing this to this situation. I'll let you know when ready


RE: catch-all content-handler - JuergenS - 08-18-2021

https://Mydomain.com/URLBase/
https://Mydomain.com/URLBase

The problem with accessing the second URL with no slash at the end was not caused by Intraweb,
but through a faulty redirection entry with my Internet service provider and has now been resolved.

With IW15.2.36 my "catch-all" content handler also works as expected.

Many thanks for the help.