{"id":33490,"date":"2017-12-01T03:01:49","date_gmt":"2017-11-30T17:01:49","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=33490"},"modified":"2020-02-16T13:27:53","modified_gmt":"2020-02-16T03:27:53","slug":"web-server-error-pages-and-ssl-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/web-server-error-pages-and-ssl-tutorial\/","title":{"rendered":"Web Server Error Pages and SSL Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/shtml_pages.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Web Server Error Pages and SSL Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/shtml_pages.jpg\" title=\"Web Server Error Pages and SSL Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Web Server Error Pages and SSL Tutorial<\/p><\/div>\n<p>As far as <a target=_blank href='https:\/\/en.wikipedia.org\/wiki\/Apache_HTTP_Server' title='Apache web server information from Wikipedia ... thanks'>Apache<\/a> web servers go, the messages from users and between web pages themselves as part of navigation can contribute to errors with web access to web applications.  What happens when these errors happen?  The errors are <a target=_blank title='Error number categories for our 4 of interest and more here, thanks W3C' href='https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html'>categorized<\/a> into error <i>number<\/i> categories, the four of which we address at our rjmprogramming.com.au domain as &#8230;<\/p>\n<ul>\n<li>\n<blockquote cite='https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html'><p>10.4.5 404 Not Found<br \/>\n<b><\/b><br \/>\nThe server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable. <\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote cite='https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html'><p>10.4.4 403 Forbidden<br \/>\n<b><\/b><br \/>\nThe server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead. <\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote cite='https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html'><p>10.5.1 500 Internal Server Error<br \/>\n<b><\/b><br \/>\nThe server encountered an unexpected condition which prevented it from fulfilling the request. The server encountered an unexpected condition which prevented it from fulfilling the request. <\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote cite='https:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html'><p>10.4.1 400 Bad Request<br \/>\n<b><\/b><br \/>\nThe request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. <\/p><\/blockquote>\n<\/li>\n<\/ul>\n<p> &#8230; and there will be a default error message (like that to the right for Bad Request error 400 in today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/shtml_pages.jpg\" title='Click picture'>tutorial picture<\/a>) if one of these scenarios above happens, unless, in the relevant domain&#8217;s <a target=_blank title='Apache web server Document Root' href='https:\/\/httpd.apache.org\/docs\/2.4\/urlmapping.html#documentroot'>Document Root<\/a> directory called [ErrorNumber].shtml and which is an HTML webpage the manager of the website can maintain, and update as required.  We do that today, for the first time, for error code 400, the &#8220;Bad Request&#8221; error, and 400.shmtl error webpage in the Document Root of the rjmprogramming.com.au domain.  That error 400 is an interesting one.  Did you know that a URL of the form <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/%\"><i>[domainDocumentRoot]\/%<\/i><\/a> (but please note the warnings above about not repeating these bad URLs) at the web browser address bar is enough to trigger a &#8220;Bad Request&#8221; error 400 scenario (thanks to <a target=_blank title='Useful link, thanks' href='https:\/\/stackoverflow.com\/questions\/16666295\/how-to-create-400-bad-request-so-that-i-can-verify-a-feature'>this useful link<\/a> for ideas here)?  And, while we are at it, substitute <i>%<\/i> for rubbish like <i>thgdhgfdhgfdhgfdhgfdhgfdghf<\/i> to test for the Not Found 404 error here, all good stuff for your checking of your error webpage maintenance testing.<\/p>\n<p>Back to Bad Request 400 error, it can happen in this bad URL way (in that <i>%<\/i> forced way above) as well as when <a target=_blank title='Cookie information from w3schools' href='http:\/\/www.w3schools.com\/js\/js_cookies.asp'><i>HTTP Cookies<\/i><\/a> break length limits for your domain, but the pain can be spread onto the poor client, if data involved breaks Cookie length limitations, and it is useful to point this out as a possibility for the user clearing some browsing history being a good idea sometimes, as you can see happening on today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/shtml_pages.jpg\" title='Click picture'>tutorial picture<\/a>.<\/p>\n<p>Two more aspects here are &#8230;<\/p>\n<ul>\n<li>maybe now, you can see how a user could be put off your website should you not have personalized some of these scenarios (via Document Root [ErrorCode].shtml error webpages)<\/li>\n<li>the same SSL principles of hard coded HTTP:\/\/www.rjmprogramming.com.au URLs (in our case) in these Document Root error webpages can result in Mixed Content problems and so any of these HTTP:\/\/ should be mapped to \/\/ in the code, as you would hear a lot about following that series of blog postings of the recent past reading down from <a title='SSL Supervisory Web Application Primer Tutorial' href='#sslswapt'>SSL Supervisory Web Application Primer Tutorial<\/a> below<\/li>\n<\/ul>\n<hr>\n<p id='sslswapt'>Previous relevant <a target=_blank title='SSL Supervisory Web Application Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/ssl-supervisory-web-application-primer-tutorial\/'>SSL Supervisory Web Application Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/SSL\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"SSL Supervisory Web Application Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/SSL\/ssl_rjmprogramming.jpg\" title=\"SSL Supervisory Web Application Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">SSL Supervisory Web Application Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve decided we can&#8217;t just jump straight to the idea of all the URLs at RJM Programming being accessible in an <i>https:<\/i> <a target=_blank title='SSL information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Transport_Layer_Security'>SSL<\/a> way &#8220;just like that&#8221;.  It could take a while to ease our way into that scenario.  So what is the next best thing?  Create an environment where there is a supervisory web application overseeing child (HTML) iframe web applications, that are called with the <i>https:<\/i> protocol because all their URLs are defined with a <i>\/\/<\/i> prefix propogated down from their parent web application to inherit the protocol of the parent.  In the meantime, we&#8217;re going to ensure that the parent gets an <i>https:<\/i> prefixed <i>top.document.URL<\/i> associated with it.<\/p>\n<p>Now, back at <a target=_blank title='SSL Certificate Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/ssl-certificate-primer-tutorial\/'>SSL Certificate Primer Tutorial<\/a> we established that &#8230;<\/p>\n<ul>\n<li>a web server 301 HTTP: redirect could do this &#8230;<\/li>\n<li>or we could do an Apache (web server) mod_rewrite module controlled <i>.htaccess<\/i> scenario in a new web server folder of interest, as explained at <a target=_blank title='Apache http: redirect to https: via Apache mod-rewrite module and an .htaccess file' href='https:\/\/www.sslshopper.com\/apache-redirect-http-to-https.html'>this webpage<\/a> as &#8230;<br \/>\n<code><br \/>\nRewriteEngine On<br \/>\nRewriteCond %{HTTPS} off<br \/>\nRewriteRule (.*) https:\/\/%{SERVER_NAME}\/$1 [R,L]<br \/>\n<\/code><br \/>\n &#8230; but we decide to &#8230;\n<\/li>\n<li>or we could write a redirecting piece of Javascript <i>document.body<\/i> onload event piece of logic <b>as per<\/b> &#8230;<br \/>\n<code><br \/>\n\/\/ more Javascript here<br \/>\n<b>function startoff() {<br \/>\n  var j;<br \/>\n  if (isoft &lt; 0) {<br \/>\n    if (document.URL.indexOf('HTTP') != 0 && document.URL.indexOf('https:') != 0) location.href='https:' + document.URL.replace('http:','').replace('https:','');<\/b><br \/>\n    for (j=0; j&lt;softwares.length; j++) {<br \/>\n      selsoft=selsoft.replace(\"&lt;\/select&gt;\",String.fromCharCode(10) + \"&lt;option value='\" + softwares[j].split(';')[1] + \"'&gt;\" + softwares[j].split(';')[0] + \"&lt;\/option&gt;&lt;\/select&gt;\");<br \/>\n    }<br \/>\n    document.getElementById('wa').title=\"Click to have here the dropdown \" + selsoft;<br \/>\n  <b>}<\/b><br \/>\n  isoft=eval((isoft + 1) % softwares.length);<br \/>\n  if (document.getElementById('dcontent').innerHTML.indexOf('&lt;iframe ') == -1) {<br \/>\n    document.getElementById('ibut').value=softwares[isoft].split(';')[0];<br \/>\n    document.getElementById('ibut').title=softwares[isoft].split(';')[1];<br \/>\n  }<br \/>\n  setTimeout(startoff,5000);<br \/>\n<b>}<\/b><br \/>\n\/\/ more Javascript here<br \/>\n&lt;\/script><br \/>\n&lt;\/head><br \/>\n&lt;body <b>onload='startoff();'<\/b> style='background-color:lightblue;'&gt;<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p> &#8230; and we plump for that last idea, but you should, yourself, if you are wanting good SEO outcomes, consider that the other two ideas might result in better SEO outcomes.<\/p>\n<p>Which leaves us with today&#8217;s SSL supervisory web application with this <a target=_blank title='SSL Supervisory at RJM Programming' href='https:\/\/www.rjmprogramming.com.au\/SSL\/'>live run<\/a> link, and this &#8220;first draft&#8221; HTML and Javascript code you could call <a target=_blank title='ssl_rjmprogramming.html' href='https:\/\/www.rjmprogramming.com.au\/SSL\/ssl_rjmprogramming.html_GETME'>ssl_rjmprogramming.html<\/a> as you see fit.  It is a web application that starts out with big &#8230; really big &#8230; HTML input type=button buttons that are replaced by HTML child iframe hosted (SSL protocoled) web applications.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d30099' onclick='var dv=document.getElementById(\"d30099\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/file\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d30099' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d33490' onclick='var dv=document.getElementById(\"d33490\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/error\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d33490' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>As far as Apache web servers go, the messages from users and between web pages themselves as part of navigation can contribute to errors with web access to web applications. What happens when these errors happen? The errors are categorized &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/web-server-error-pages-and-ssl-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[1669,85,2354,264,1750,355,1929,2267,3226,2355,997,1682,1319,1345,1404,1411,1421],"class_list":["post-33490","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-address-bar","tag-apache","tag-bad-request","tag-cookies","tag-document-root","tag-domain","tag-error","tag-error-message","tag-mixed-content","tag-not-found","tag-programming","tag-ssl","tag-tutorial","tag-url","tag-web-browser","tag-web-server","tag-website"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33490"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=33490"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33490\/revisions"}],"predecessor-version":[{"id":33498,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33490\/revisions\/33498"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=33490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=33490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=33490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}