Page MenuHomePhabricator

Some IIS-based configuration doesn't serve 404 errors from PHP correctly
Closed, InvalidPublic

Description

Author: scd

Description:
Hello,
Perhaps I am overlooking something really simple.
1>
The links at the top for the user page, user talk are red links, that's normal, they have not been created yet. But they do not contain the "&action=edit&redlink=1" at the end in order to create the page.
When I click, I simply get a default web 404 error page. It should get me to at least a "create this page" type of page.
2>
This is probably something I have not configured yet, but any entry of the order of "user:xxxx" or "desjardins:xxxx" etc.. typed into the text box in the left menu or when I link to the blue "about:desjardins" link etc.. they also come up as a 404 errors.
I should be at least pointed to a "create this page" type of page also.

Please let me know what I am over looking or if I am actually crazy! :>

Thanks


Version: 1.14.x
Severity: major
OS: Windows Server 2003
Platform: PC
URL: http://wiki.ourfamilyzoo.net

Details

Reference
bz18270

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:31 PM
bzimport set Reference to bz18270.
bzimport added a subscriber: Unknown Object (MLST).

Some problem with IIS; looks like it sends it's own 404 pages overriding MediaWiki's.

scd wrote:

The problem is that the correct links are not being created by the wiki software. It is making the links red, because the pages do not exist, but not appending the "&action=edit&redlink=1" at the end of the link and therefore the page is not found, which is correct. HOW DO I GO ABOUT CORRECTING THE LINK CREATION.

scd wrote:

(In reply to comment #1)

Some problem with IIS; looks like it sends it's own 404 pages overriding
MediaWiki's.

The problem is that the correct links are not being created by the wiki
software. It is making the links red, because the pages do not exist, but not
appending the "&action=edit&redlink=1" at the end of the link and therefore the
page is not found, which is correct. HOW DO I GO ABOUT CORRECTING THE LINK
CREATION.

scd wrote:

I am still having the same problem and have not found a solution to this. Thank you.

Fix your IIS so that it does not override MediaWiki's 404 error pages with it's own. As far as I can see this is a configuration error of the server and has nothing to do with MediaWiki. Please provide more details if this is not the case.

scd wrote:

Okay, There seems to be a communication issue(In reply to comment #5)

Fix your IIS so that it does not override MediaWiki's 404 error pages with it's
own. As far as I can see this is a configuration error of the server and has
nothing to do with MediaWiki. Please provide more details if this is not the
case.

There is nothing wrong with the IIS, The wiki software is not creating the correct redlinks for user pages and user talks, for example if you create a new page the talk page is a red link and at the end of the hyperlink wiki software appends "&action=edit&redlink=1" so that the page is created. At the top of the page where the user page link is, and the user talk page link is that is not appended. Where do I fix that.

scd wrote:

FYI, mediawiki 1.14.0 did not contain any 404 error pages.

They point to 'view the page' instead of 'edit the page', granted, but that shouldn't show the 'default web 404 error page'.
Which skin are you using? What happens if you browse to a random page title?
Is it IIS 404 oage or Internet Explorer?

Is it on a public site where it can be viewed?

scd wrote:

Hi There,
I have tried it with all the skins.
random page seems to work fine. it's just the "User"links, and any wiki type pages that haven't been created when searching.
you can always go to wiki.ourfamilyzoo.net

(create a user account if you want, the page gives an error about the e-mail, I haven't figured that yet, but it works?)

S.

No, the problem is with IIS configuration, overriding the 404 page.

You can use this testcase:
<?php
header("HTTP/1.x 404 Not Found");
echo 'Nothing here, go to the <a href="/">main page</a>';
?>

The above php should show the text "Nothing here, go to the main page", but with your configuration, it'll show the default IIS 404 error.

As a woraround, you can remove from Article.php the lines 841-843:

if( $return404 ) {
    $wgRequest->response()->header( "HTTP/1.x 404 Not Found" );
}

but it is NOT recommended.
The server config should be fixed instead.

scd wrote:

(In reply to comment #10)

No, the problem is with IIS configuration, overriding the 404 page.

You can use this testcase:
<?php
header("HTTP/1.x 404 Not Found");
echo 'Nothing here, go to the <a href="/">main page</a>';
?>

The above php should show the text "Nothing here, go to the main page", but
with your configuration, it'll show the default IIS 404 error.

As a woraround, you can remove from Article.php the lines 841-843:

if( $return404 ) {
    $wgRequest->response()->header( "HTTP/1.x 404 Not Found" );
}

but it is NOT recommended.
The server config should be fixed instead.

I don't see what you are talking about. The red links to for example to a regular article have the links correct, but the red links to ones own talk page or user page are not correct. How do I fix the link creation for these links? I do not see how that has anything to do with what 404 error I am receiving.

(In reply to comment #11)

I don't see what you are talking about. The red links to for example to a
regular article have the links correct, but the red links to ones own talk page
or user page are not correct. How do I fix the link creation for these links? I
do not see how that has anything to do with what 404 error I am receiving.

Go to a non-existent page on any other wiki, eg. http://test.wikipedia.org/wiki/FooBar
You get a wiki page saying that it's empty, and offering to create it.

Now, try to do it on your wiki. You get an IIS message error. That's what you need to
solve. IIS is seeing that mediawiki gives a 404 (per bug 2585) and shows its own page
instead of the one mediawiki provides.

Updated summary to describe the issue.

Note that the example URL currently displays a MySQL connection error, so we can't test the wiki's behavior on that server.

scd wrote:

(In reply to comment #12)

(In reply to comment #11)

I don't see what you are talking about. The red links to for example to a
regular article have the links correct, but the red links to ones own talk page
or user page are not correct. How do I fix the link creation for these links? I
do not see how that has anything to do with what 404 error I am receiving.

Go to a non-existent page on any other wiki, eg.
http://test.wikipedia.org/wiki/FooBar
You get a wiki page saying that it's empty, and offering to create it.

Now, try to do it on your wiki. You get an IIS message error. That's what you
need to
solve. IIS is seeing that mediawiki gives a 404 (per bug 2585) and shows its
own page
instead of the one mediawiki provides.

I do not see any error pages provided by the mediawiki software, If you could point me to what page the 404 is supposed to point to than I am happy to do so. I came here for help, cause I obviously had an issue. I followed (probably should not have) the instructions for installing mediawiki software, and this is where I am at now.

scd wrote:

Okay just to make sure that I did everything right according to your instructions I did another clean install with a once again fresh download of the wiki software, and I am still having the same issue with a generic 404 page coming up. It happens when:

I click on the links to a user page that does not exist.
I click on the links to a users talk page that does not exist. (When I click on a talk page to an article that does not yet have a talk page of it's own, it goes directly to the editing this page function through the &redlink=1 that is already in the hyper link)
I click on a link for a "special page" ( like help:xxxx or desjardins:xxxx) that does not exist.
I type in the search box anything with a colon (user:someone, or help:something) that a page does not exist and then clock on "GO" or press the Enter key. (But I get the correct Wiki the page does not exist etc... page when I press "search".)

So that tells me something is missing in the error checking of the wiki software to properly handle non existant pages and therefore gives up and IIS has nothing better to do than return a 404 page.

I do have programming knowledge but I am not an expert php programmer, I am not an expert webmaster, I simply followed the instructions provided and this is what I am encountering. I do not recall anywhere telling me where I needed to set up how to handle 404 errors, or non-existent pages, or that I had to set up IIS any diferently to handle 404 errors other than what was there already.

If you want anything useful out of this bug: Figure out why IIS is doing it. Is it the default behaviour? Which versions are affected? How to configure it off if possible?

FYI: bug 17042 is about fixing the few specific problems you mentioned, but not about IIS doing bad things. You can test how it is supposed to work in any other wiki, like en.wikipedia.org.

(In reply to comment #15)

So that tells me something is missing in the error checking of the wiki
software to properly handle non existant pages and therefore gives up and IIS
has nothing better to do than return a 404 page.

No, that's incorrect. The wiki returns the page you're expecting with a 404 error code, and IIS detects the 404 code and wrongfully decides to serve its own error page instead, overriding MediaWiki's. Try the testcase from comment #10 to confirm this.

jmiller wrote:

I'm having this same problem so if anyone knows the exact steps to fix it would be much appreciated.

jmiller wrote:

I think I found a fix!!
Try this and let me know if it works for you.

Got to IIS Manager.
Open Web Sites.
Right lick on the website and select Properties.
Go to the Custom Errors tab.
Scroll down to the 404 error, select it and click the "Set to Default" button.

jmiller wrote:

Make that a "right CLICK". Licking might not help.

Closing as INVALID, as this is clearly an IIS config issue, not a bug in MediaWiki, and because a fix is mentioned in comment #19.

scd wrote:

(In reply to comment #19)

I think I found a fix!!
Try this and let me know if it works for you.

Got to IIS Manager.
Open Web Sites.
Right lick on the website and select Properties.
Go to the Custom Errors tab.
Scroll down to the 404 error, select it and click the "Set to Default" button.

Thank you, This seems to work. Not exactly as I would like, but it works.
The IIS setup was already set to default (As it was a brand new website added into IIS), but somehow when I did this it must have re-initialized and now it works.
Thank you.

jthiesen98 wrote:

The fix mentioned in #19 above is not quite accurate for IIS 7.0. Here is the workaround I found.

Open inetmgr. Expand Sites and expand your website. Select the folder for your wiki in the tree (/wiki in my case). Double click the Error Pages icon. Right click in the list and select Edit Feature Settings. Select "Detailed errors". Click OK.

azeeznm wrote:

i have same problem. this is my url www.ponkavanam.com. i installed mediawiki 13 to my godaddy host. it is running long year perfectly . but recently i try to upgraded mediawiki 15. it ok .but problem that when i click a non exiting page in sidebar it is going to page not found page. that why downgrade same as old. after that it is working very well . i don't know actually what is the problem.

today i installed mediawiki 15 in subdomain folder. see this urlhttp://islahicenter.ponkavanam.com

still exist the same problem.
any one know to resolve the problem?

It's not a mediawiki bug. You have IIS misconfigured.
Comment #19 explains how to fix it. In your case, you may need to contact your hosting to fix it.

azeeznm wrote:

how the mediawiki 13 working
eg: www.ponkavanam.com and
mediawiki 15 not working????
eg: http://islahicenter.ponkavanam.com

MediaWiki 1.13 flags non-existing pages with code 200, which mean that the page exists and is found. MediaWiki 1.15 gives a 404 HTTP code and gives the same page as before, *which IIS is ignoring*.

*You have IIS misconfigured*
Don't ask us to configure your server.

T97243 Cloudflare also messing with the "create this page" article.