Why is my web server adding a line to my source code? - coldfusion

This question as first asked was closed by three experts who were convinced that the source code displayed by the browsers had to be the same as the code which I uploaded to my web host server. I knew that this was not the case, therefore the problem must lie with my web hosting ColdFusion server, as it is highly unlikely that all three browsers would make the same mistake.
My page (https://gustav-mahler.org/nachrichten/pdfs.cfm) begins like this:
<!DOCTYPE html>
<html>
<head>
However in Chrome 80, MSIE 11 and Firefox 73.0.1, the source code is displayed like this:
--->
<!DOCTYPE html>
<html>
<head>
I am now suspecting that the string "--->" must have been added by my ColdFusion webserver for some reason, as that string normally indicates the closing of a ColdFusion comment. But in this case there is no comment to close. I have added a ColdFusion tag to this question, and if this problem is unknown to CF experts, I shall have to ask my web host technician for advice.

This is a very long comment that tells you how to find the source of the problem.
On the host server, create an html page with a doctype tag, plus opening and closing html, head, and body tags. Add a short paragraph, inside p tags. Browse the page and check the html source for the extra line.
If it's there, talk to your hosting company. Otherwise, rename the file from .html to .cfm. Browse and check again.
If the line is not there, it's likely your code. Start adding lines of ColdFusion code, one or two at a time and keep testing until the line appears.

Related

Amazon AWS S3 Site Update

I've looked through just about every related question on here that I can find and none of the suggested solutions seem to resolve my problem.
I'm currently hosting a website on Amazon AWS using strictly the S3 and Route 53 tools to host a static website and re-route from a couple of different URL queries to our site. This morning I attempted to update the CSS files being used to style the webpage, as well as a bunch of new image files and some minor updates to the HTML pages, and noticed that all of my changes showed up immediately on the webpage except the changes I had made to my CSS file. I've checked, and the version of the file on the S3 is the correct/updated version, but when I attempt to use the Developer Tools in my web browser to inspect the webpage displayed, it's still showing an older version of the css file. This doesn't make any sense to me, as all of the other changes show up immediately except for this particular file. Does anyone have any thoughts on how to fix this/what could be going wrong?
NOTE: I'm not using AWS CloudFront on this webpage at all so I don't believe that any of the "invalidation" suggested elsewhere will help me. In the past, I've updated the files and seen immediate changes when loading my webpage.
You already know this is a browser cache issue - which you can clear the cache, but if you want to force everyone to automatically get the new CSS, what I usually do is add a query parameter to the file include, i.e. instead of
<link href="~/css/plugins/thickbox/thickbox.css" rel="stylesheet" />
do this:
<link href="~/css/plugins/thickbox/thickbox.css?v=1001" rel="stylesheet" />
and you can up the 1001 each time you push out an update - the browser will automatically grab the new file.
Google 'cache-busting' for other options.

project set up using github pages not loading

I hosted one of my project using GitHub pages but, for some reason, when I access the URL the page doesn't loads, and when I check it in the dev console it shows this error.
This is my GitHub page URL: https://prasunk96.github.io/colorsgame/
I checked that all the internal links that I have in my html file are all correct.
I have tried it several times but it showing the same problem again and again.
There are two issues with your CSS link:
It is not relative to your html file so the browser is trying to go directly from the base prasunk96.github.io/ and not include the /colorsgame/.
Github.io urls are case sensitive so your colorGamepro.css isn't being matched to the ColorGamepro.css file.
To correct the relative url you can either add a base tag to your HTML file or use a relative href. Once you correct the file name it should be able to find your file at https://prasunk96.github.io/colorsgame/css/ColorGamepro.css
In short use: href="./css/ColorGamepro.css"
Github project pages can sometime take a bit before being updated. See "My GitHub page won't update its content" for a similar issue.
I do see (a few hours later) a 404 for your css:
Try and see if using an anchored url works better:
<link rel="stylesheet" type="text/css" href="/css/colorGamepro.css">
^^^
|

WHy is WAMP not working?

I'm trying to teach myself web development, but I cannot seem to get wamp to work. I have Installed the program and after changing the port I now get a green logo.
The tutorial tells me to double click on the index.php file in the www directory of the WAMP program files, this gives me this.
I'm then told to change the address from
file:///C:/wamp/www/index.php to localhost/index.php, but when I do I just get a blank page.
I would like to know what I'm doing wrong.
Thank You.
You are doing good,
you did put your server online and access the index.php successfully.
The main problem is that you didn't use "echo" in php to print anything on the page or write any html code so the browser cannot render anything.
Try to copy and website source code or as simple as follow:
<html>
<head></head>
<body>
<h1>Hello World</h1>
</body>
</html>
It should work as a web page as expected.
Remeber,if you changed port no. in the config file, please change the URL to
localhost:portno/index.php such as localhost:8080/index.php

What might cause the images from rendering properly in PDF generation?

I am using ColdFusion 8.
I have a perfectly formatted HTML page that I want to convert into PDF. It takes ColdFusion about 250 milliseconds to create this content. The code is tried and true and works in every respect with no problem, except for in creating a PDF.
I create the PageContent variable like this:
<!--- CREATE PAGE AS CONTENT --->
<cfsavecontent variable="PageContent">
<html>
<head></head>
<body>
<cfoutput>
// PAGE CONTENT IS HERE
<cfoutput>
</body>
</html>
</cfsavecontent>
I can display this PageContent perfectly as HTML in a browser, open it in Word or Excel. I try to create a PDF like this:
<cfdocument format="pdf">
<cfoutput>
#PageContent#
</cfoutput>
</cfdocument>
The page content has inline styles, images, divs, and tables. If I remove the image path and file with an empty string, the document works. Here's the
I think that the PDF generator is choking ob the image path, although the paths seem perfect to me and render well everywhere else. The img tag is being fed the full HTTP path, which is totally valid. Here's one that isn't working:
http://dev.iqcatalogs.com/avcat/IMAGES/products/spotlight/ef17_40_4lu_c2_186x279.gif
What might cause the images from rendering properly in PDF?
(From the comments above) I am guessing you have looked into the usual suspects already?
ie 2) If your server is behind firewall. As we mentioned earlier, CF
server needs to send an HTTP request for the images. If the firewall
prevents any outgoing connection from the server, CF will not be able
to retrieve them and will show a red-x in place of them. You will need
to setup your firewall in such a way that server can send an HTTP
request to itself.
Remember that for Cfdocument to work it doesn't matter whether you can pull up the image in your browser. It only matters if the server can pull it up. The most likely cause for this is simply domain resolution - where the server cannot get the right IP address - or where it is blocked from retrieving the content. See this post.
resolution and cfdocument

ColdFusion blank page in IE7 on refresh?

I'm new to ColdFusion, have a very basic problem that's really slowing me down.
I'm making edits in a text editor and refreshing the page in web browsers for testing. Standard web dev stuff, no browser-sniffing, redirection, or other weirdness, and no proxies involved.
When I refresh the page in Chrome or Firefox, everything works fine, but when I refresh in IE7, I get a blank page. View Source shows me:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8"></HEAD>
<BODY></BODY></HTML>
That's it. While I am rendering to the transitional DTD, the real head contains a title, etc.
My development server is CF 9, production is 8. This problem has been happening in both. Seems it may only be happening on pages that are the the result of a POST action.
I've never experienced this in ASP.NET (my usual development environment) using the same browsers.
If I remember correctly, IE does not re-post forms on refresh by default. It's been a few years since I used it for more than testing. However, I also recall it giving a message like "this page has expired" or something similar, so this may not be the issue you are experiencing.
I assume you're using IIS - If so, just to make sure that you get a fresh version of the page every time, set the content expiration (under HTTP headers in the site configuration) to "immediately"
Also, clear your IE cache and cookies... And, in CF admin, un-tick the "Enable HTTP status codes" option in the main setting page.