Relative image tag fails

Hi All,

I’m an old hand at ACF, but just starting out trialling Lucee. I suspect I’ve missed something in the setup / install.

I can run a test program which is in my app folder, but an image tag with a relative url fails.

With img src=“http://127.0.0.1/app/face.png” it works fine,

If img src=“face.png” it is not displayed,

How can I get a relative URL to work? Any help appreciated.

Many Thanks

OS: Windows 10
Java Version: 11.0.7
Tomcat Version: 9.0.35
Lucee Version: 5.3.6.061

Hi @Sting! Welcome to our community!

Are all your application files inside the folder named “app”? Does this issue with the relative path apply to all of your files (not olny png, but also cfm, css files)? If it affects all of your files, not only the images, I would setup the webroot for tomact to be “Path/to/your/folder/app/” in the context section in tomcat. An alternative would be to create a URLRewrite rule, but that should be done in the setup of a fronted web server (e.g. IIS or Apache for Windows). You can of course setup URLRewrites also in Tomcat, but that is very unusual, and should only be applied if you can somehow sync your Tomcat URLRewrite rules of your development machine with the rules of the front end webserver in production.

Thanks so much Andreas. I’m sure your on the right track, but I need a bit more help as I am not familiar with setting up tomcat. Also I am in Australia. I assume your in a different time zone, so our responses will be a bit delayed, but not for lack of interest,

I tried changing C:\lucee\tomcat\conf\context.xml from

to

and restarted the service but this did not help.

I also tried changing C:\lucee\tomcat\conf\server.xml to include


127.0.0.1

but the service would not start when this was included just above the tag.

Again, any elp is much appreciated.

And changing angle brackets for round brackets…

Thanks so much Andreas. I’m sure your on the right track, but I need a bit more help as I am not familiar with setting up tomcat. Also I am in Australia. I assume your in a different time zone, so our responses will be a bit delayed, but not for lack of interest,

I tried changing C:\lucee\tomcat\conf\context.xml from
(Context useHttpOnly=“true”)
to
(Context useHttpOnly=“true” docBase=“D:/telligence/app”)
and restarted the service but this did not help.

I also tried changing C:\lucee\tomcat\conf\server.xml to include
(Host name=“127.0.0.1” appBase=“webapps”)
(Context path="" docBase=“D:\telligence” /)
(Alias)127.0.0.1(/Alias)
(/Host)
but the service would not start when this was included just above the (/engine) tag.

Again, any help is much appreciated.

I’m in Germany. Greetings to Down Under :smiley: How did you install your Lucee? Did you use the installer, or are you using the express version?

Before going further, solving your issue… what do you want to do on your Win10? What are you installing Lucee for? If it’s meant to be just for development and trying things out with CFML, then I wamly recommend using commandbox from ortus soultions, it’s really great for development and you can jump between CF-Engines from Lucee and Coldfusion. To run an Lucee server instance with commandbox it’s as easy as changing into your apps webroots with cmd and start it from there. At the beginning I was developing always with lucees express version because it’s very portable, but using commandbox it’s sooooo damn easy. But, if you want to learn about Lucee with Tomcat, use the Express Version as a start. If you want to go into production, I would go with the Lucees installer, but then I would install it directly on a Server OS like Windows Server 2019. It really depends on what you want to do.