Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
catch-all content-handler
#1
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.
Reply
#2
How are you registering them?

Is URLBase2 registered as document or as path?
Reply
#3
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?
Reply
#4
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.
Reply
#5
(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)
Reply
#6
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.
Reply
#7
I'll see if I can adapt our existing demo showing this to this situation. I'll let you know when ready
Reply
#8
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)