Project

General

Profile

Actions

Feature #1407

closed

Return specific server status: 404 (Not Found), 301 (Moved Permanently)

Added by Ed Base over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
08/21/2012
Due date:
% Done:

0%

Estimated time:

Description

Wt always returns 200 OK server status for requests within internal path structure. For sites aimed at search engines, this is not optimal behavior. (404 and 301 server status codes are often needed.)

404 Not Found: Koen proposed a solution here: http://redmine.webtoolkit.eu/boards/2/topics/1965#message-1975. It was to create a method void WApplication::setInternalPathValid(bool valid) which would generate the 404 response in a plain HTML session and the page would be unchanged from thereon. Although, it would be perfectly fine if setting the 404 error would return a proper response and an error page setup with ---errroot.

301 Moved Permanently: void WApplication::redirect(...) sets the 302 code upon redirection. As similar method or a parameter within this redirect function to set the 301 response instead would be of great benefit.

Regards

Actions #1

Updated by con abs over 11 years ago

oops! That's what I am looking for.

Actions #2

Updated by Koen Deforche over 11 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version set to 3.2.3

Hey,

I've added a few methods to my git copy that allow you to return a 404, but I think it's a bit of an experiment: because internal path handling can be 'distributed' to many widgets, this is not easy to handle correctly.

The methods are:

  void setInternalPathDefaultValid(bool valid); // defaults to 'true'
  bool internalPathDefaultValid() const;

  void setInternalPathValid(bool valid);s
  bool internalPathValid() const;

They have only an effect in plain HTML sessions (and probably are most useful only for bots), where they will return 404 for an invalid internal path.

Regards,

koen

Actions #3

Updated by Koen Deforche over 11 years ago

  • Status changed from InProgress to Resolved
Actions #4

Updated by Koen Deforche over 11 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF