Skip navigation
Currently Being Moderated

ColdFusion 10, IIS 7.5, and custom 404 page

Jul 31, 2013 9:11 PM

Tags: #windows #iis #cf10

I am attempting to setup a custom 404 error with CF10 and IIS 7.5. Previous to CF10 (and IIS 7), you can get the URL of the non-existent page via the querystring (e.g., 404;http://www.example.com/some/file.html) when the custom 404 page is processed. However, with CF10 and IIS 7.5, the querystring returns 404;http://www.example.com/jakarta/isapi_redirect.dll. Is there a way to retrieve the actual URL of the missing path, like in prior versions?

 
Replies
  • Currently Being Moderated
    Aug 1, 2013 1:10 AM   in reply to rhpt

    what do you get if you dump the CGI scope?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2013 12:33 PM   in reply to rhpt

    Is jakarta (virtual directory) added in your website under IIS?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2013 6:26 AM   in reply to rhpt
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2013 11:10 AM   in reply to rhpt

    Hi

     

    For 404.cfm to display when access a non -exisiting .cfm and .html, you need to place the 404.cfm in both ColdFusion webroot (wwwroot) and your website's webroot.

     

    Your web.config should look like this

     

    <?xml version="1.0" encoding="UTF-8"?>

    <configuration>

        <system.webServer>

            <httpErrors errorMode="Custom">

                <remove statusCode="404" subStatusCode="-1" />

                <error statusCode="404" prefixLanguageFilePath="" path="/404.cfm" responseMode="ExecuteURL" />

            </httpErrors>

        </system.webServer>

    </configuration>

     

     

    Now when you access a non exisiting .html say http://www.adobe.com/hello.html then URL should redirect to http://www.adobe.com/404.cfm, below are the steps to follow.

     

    If you want to do the same for site level, then go to error pages in IIS for your site

     

    IIS2.jpg

     

    Choose Respond with a 302 direct with the 404.cfm URL placed in the webroot of your website

     

    IIS.jpg

    Hope it helps

     

    Thanks

    VJ

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2013 12:15 PM   in reply to rhpt

    Just for testing purpose, can you add a new site in IIS. Configure connector with that website using wsconfig and place the 404.cfm in this website's root. Add jakarta as virtual directory under this new site if it is not there (it will show up as you will configure the connector for this website). Follow the above steps and then share your findings.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2013 10:31 AM   in reply to rhpt

    Wow, Interseting Sometimes you try your level best to reproduce but at the end of the day you end up trying it

     

    Is it possible to install CF 10 as Development in any of the dev/test server, where you can test the same?

     

    Also, can you provide the screenshot of IIS installed role services

     

    iis7_windows_authentication.png

     

     

    Thanks

    VJ

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2013 3:17 PM   in reply to rhpt

    These are the role services for IIS. As IIS is your webserver, so choose IIS, expand all the features of IIS and then provide it's screenshot.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 23, 2013 11:18 AM   in reply to rhpt

    Thank you for sharing. Just tested with same IIS role services in both (Server 2003/2008) and then installed CF 10. Still not able to repro it. If possible, can you test the same like if you can perform the test on a VM server 2008?

     

    This is my web.config

     

    <?xml version="1.0" encoding="UTF-8"?>

    <configuration>

        <system.webServer>

            <httpErrors errorMode="Custom">

                <remove statusCode="404" subStatusCode="-1" />

                <error statusCode="404" prefixLanguageFilePath="" path="/404.cfm" responseMode="ExecuteURL" />

            </httpErrors>

        </system.webServer>

    </configuration>

     

    P.S : I was testing a 404.cfm as a template for 404 error in IIS. so sorry about that in the above

     

    Can you share your web.config, if possible?

     

    Thanks

    VJ

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 9, 2013 10:08 AM   in reply to rhpt

    Did you ever figure this out?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 9, 2013 1:34 PM   in reply to rhpt

    I've got the same issue.  Just curious, are you doing any URL redirection?  For me, I have IIRF running and catching all 404s so I can do custom "search engine friendly" URLs.  The issue with jakarta/isapi_redirect.dll only occurs when I try to access a non-existant .cfm file (oddly doesn't occur when dealing with folders or other file types).

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 10, 2013 10:42 AM   in reply to rhpt

    Thanks for the link.  I did some fiddling and found a workaround using IIRF.  I posted instructions on the stackoverflow page you posted.  I think this is a bug that Adobe should address.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 29, 2013 10:02 AM   in reply to rhpt

    Was this ever resolved? Update 11 got us closer with using our custom 404, but then we hit this issue.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 2:01 AM   in reply to rhpt

    @vishu#13, having a 302 redirect to a 404 error sounds a bit strange, and may not be good for SEO.

     

    @colfaxschuyler, in your web.config, remove the httpErrors container and replace with this one tag:

     

    <httpErrors existingResponse="PassThrough" />

     

    Please see if that helps, at all.

     

    Custom 404's in ColdFusion 10 are a PITA. We still can't get non .cfm templates to 404 to a custom page and Adobe just do not have a clue!

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 6:19 AM   in reply to tribule

    This broke the 404 even more for me.

     

    Right now I can do a simple 404, if the directory doesn't exsist or a file doesn't exsist.

     

    Obviously I can't use query_string to do anything more complex. Nothing in the cgi scope is useful.

     

    Added

    <httpErrors existingResponse="PassThrough" />

     

    and I don't even hit my custom 404.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 6:49 AM   in reply to JamesSevener

    James, please paste your web.config here. Is the "Missing template handler" defined in the CF Admin, and does it point to a valid 404 template e.g. /404.cfm? Also, when you say a file doesn't exist, do you mean a .cfm file or any file type e.g. a .html file?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 6:55 AM   in reply to tribule

    <?xml version="1.0" encoding="UTF-8"?>

    <configuration>

        <system.webServer>

            <httpErrors>

                <remove statusCode="404" subStatusCode="-1" />

                <error statusCode="404" prefixLanguageFilePath="" path="/handler.cfm" responseMode="ExecuteURL" />

            </httpErrors>

        </system.webServer>

    </configuration>

     

     

    The "Missing template handler" is not defined in CF, we use the 404 error page setting in IIS.

     

    As of right now, my test site on this server is just a basic 500 line .cfm file.

     

    I've tested with non-exsistent directories, .html and .cfm. Everything works.

     

    Except when I try to redirect to certain pages based on cgi.QUERY_STRING

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 7:53 AM   in reply to JamesSevener

    Using IIS may be the reason why QUERY_STRING is missing.Why not try a custom 404 page in the CF Admin and dump the CGI scope to see what it gets?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 8:24 AM   in reply to tribule

    I will test today and post back. But as far as I know, the missing template handler is server wide. Correct?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 9:39 AM   in reply to JamesSevener

    Yes it is server-wide. I suppose you could examine the CGI scope to see if you could serve different responses to different domains.

    It'll be interesting to see what CGI variables it gives you, if any! If it does give you the data you need, you can use it as your new handler. We do this to give "intelligent" results to users, for example, we have an e-commerce site and it will show alternative/similar products if one is no longer available. Btw, check using a web sniffer to make sure your 404 handler actually does return a 404 error, otherwise it can cause SEO issues (if that is important to you.)

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 10:17 AM   in reply to tribule

    I can't seem to get the CFAdmin to accept a path for the "Missing Template Handler" Could be an issue trying to go from one partition to another.

     

    But, I don't really see this as a viable solution. We have 39 sites on this server right now, and will add more (our other servers usually have ~100).

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2013 3:47 PM   in reply to rhpt

    FYI  I've created a bug report for this issue earlier here:  https://bugbase.adobe.com/index.cfm?event=bug&id=3630245  You can vote on getting this fixed there.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points