Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to 404 is working but in chrome devtools, a 200 code is shown

My web.config looks like this:

<configuration>
    <system.webServer>
        <httpErrors>
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/error-404.cfm" responseMode="ExecuteURL" />
        </httpErrors>
    </system.webServer>
</configuration>

If I navigate to page that doesn't exist, it correctly loads up the 404 page, but chrome's network log shows a 200 response. How can I make sure there's a 404 response? Or does it matter?

like image 392
Patrick Schomburg Avatar asked Jan 21 '26 08:01

Patrick Schomburg


1 Answers

For anyone running into a similar issue, this worked for me; put

<cffunction name="onMissingTemplate"> <cfinclude template="error-404.cfm" > </cffunction>

in the application.cfc file, then put

<cfheader statuscode="404" statustext="Not Found"> at the top of error-404.cfm

like image 92
Patrick Schomburg Avatar answered Jan 25 '26 21:01

Patrick Schomburg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!