We are currently running CF 11 on Windows Server 2016 & IIS. We are looking to migrate to Lucee.
Nearly everything is fine except the REST services.
We setup our REST mappings in the Lucee admin as per how they were in CF11.
Is there additional setup documented somewhere that needs following for Lucee, IIS and REST fresh install?
When calling the REST URL it just gives a 404. When calling https://my-domain/rest it shows the REST services that have been setup as excpected.
We keep the folder outside the root of the web directory.
The URL will be something like https://my-domain/rest/mapping/cfc_name/rest_path_var
Does the IIS Connector need additional setup or is there extra config changes required for IIS. I cannot seem to find any documentation for it.
Is there a big difference in the way it works compared to CF 11?
Im hoping that there is a bit of documentation somewhere that I have missed that gives an idea on what needs to be done
Can you check in your lucee install directory for a file called
conf/web.xml, which is a big XML file and you should check that an servlet entry like the one below is there and not commented out.
You can then go to the lucee administrator and create the mappings as required:
So for example, for “virtual” you could put “mapping” and for physical that would map to your folder outside your root directory.
Then check it with the local port of lucee (which should be 8888 to ignore IIS) and if that works, then try it with IIS .
If that DOESN’T work (and I am no expert at IIS here) but what you would need to do is tell it that all requests to
/rest are handled by the same handler that does .cfm and .cfc (request handlers? can’t remember the name off hand)
Thanks for the reply.
The servlet is not commented out but does have load-on-startup set to 2.
The mapping I have already added, and if I tick the “list services” option it does show when going to http://my-domain/rest. I have confirmed file paths. The mapping is the same as the CF 11 one I had.
If I eliminate IIS and use the Tomcat port on the following url - http://my-domain:8888/rest/mapping/cfc_name/rest_path_var
Page …/…/…/…/…/null [C:\null] not found
Ok, a reboot of the server and this issue goes away and the rest service request appears to work fine now when called on the local tomcat instance.
So this leaves IIS. Is there additional configuration / connector changes that need to do done to get the REST services to work?
If I add a handler in for BonCode to deal with /rest/* then the list services page works. The URL doesnt. It just gives the following error:
no rest service for [/mapping] found
I have found adding the following Handler to IIS allows for the REST Services to respond correctly:
Just hope that it doesn’t have adverse effects else where. On initial viewing, everything appears to be working everywhere else.
Did I miss some documentation for this?
Here I given simple REST services
Need to enable Rest servelt mapping
Go to Admin -> Archives & Resources -> Rest
Vitrual Path: /testRestService
Create CFC here
Copy the below code & paste it in Hello.cfc
<cfcomponent rest="true" restpath="/hello">
<cffunction name="myHello" access="remote" returnType="String" httpMethod="get" restPath="/world">
<cfset res="Hello World">
Hit the URL like:
It return Hello World
At the moment the Request Path is handling EVERYTHING through Lucee, I would change it (if you can?) to something like /rest/*
I did try /rest/* originally, along with just /rest/my_mapping/* but these had no effect. It only worked when I passed everything (*) through.
I have no issue with passing it all through as its all CFML that we produce it in. Although I was concerned about static files such as css/js etc.
These all seem to work fine though.
I have been assuming I am just missing some obvious documentation if this doesnt work “out the box”. I assume others must be using IIS along with Lucee and REST services.
Both Windows Server 2016 and Lucee / IIS are a fresh install.