OK, sooo what you’re saying isn’t quite right. /etc/network/interfaces doesn’t define a way to “reference services on this box via this address”. Nor does the hosts file do anything with TCP.
/etc/network/interfaces and the related files in /etc/network/interfaces.d tells Ubuntu how to configure the interfaces in the VM or Physical machine for network communication. It defines IP configuration. (Layer 3)
Your interfaces file, for instance, does not include a default gateway. So if it’s actually being used to setup a server, it won’t be able to communicate outside that subnet, nor will anything else off that subnet be able to communicate with it. No software updates. No NTP. No DNS. No anything.
The HOSTS file doesn’t do anything with layer 3 either, nor does it define IP addresses the box responds to. All it does is associate names (like localhost) with an IP address for NAME resolution.
And if you’re trying to change a docker container’s IP address, the docker container never calls ifup, or the system init scripts, nor does it have an interface named enp0s8. You’d define that in the docker networking setup, either as part of the command line, docker compose, etc.
Without more specifics as to what you’re trying to accomplish you’re not going to get a good response. (As evident from the last couple days)
Is your nodejs API on the SAME server/container as your coldfusion code? If so, who cares what the networking is. Use 127.0.0.1 and move on.
Are they both containers? Both servers? On the same subnet? Different subnet?
What “doesn’t work” with cfhttp? What “doesn’t work” with cfexecute? Did you get an error from either? Care to share?
Personally, if we’re talking about a REST API, I would NEVER consider using cfexecute as an alternative. Java and CF support HTTP natively, why introduce the complexity? Plus, parameter parsing is problematic and unless you get it completely right, very easy to make insecure.
You started with how do you pass a token with HTTP - that’s simple -cfhttpparam. It’s either going to be URL, FORM, or Header.
The more details you give the better answer you’ll get. Even better if you show us your code. Or dumps of the error or errors. Or an example of it working. Or anything.