That is because Dashboard is actually running in your browser whereas Node-RED and its nodes is running on your Node-RED server. So you do need the actual IP address of the server if accessing via Dashboard but the localhost address if accessing via Node-RED flows.
But when you configure Node-RED's static folder, what you put in there is made available via Node-RED's ExpressJS server the same as Dashboard. So from a browser on a different device, you use the external address.
I had pretty much finished the project I was working on until I encountered this problem, and now I realise it's pretty critical.
If I could explain in slightly more detail, you might be able to point me (further) in the right direction.
If you have a webpage on a server and you want to display a video, I understood that you could reference the source as the local file path relative to the index/root, say "/videos" or something. So wherever you happened to viewing the webpage from it would still understand that local file path.
That is what I would like to do with my flow/dashboard.
At the moment, as you suggested I changed localhost to the external ip address which works fine, but I need to be able to make remote connections to the dashboard which is the problem now
At the moment I use pitunnel to remotely connect to my raspberry pi on the node red port 1880 which works fine, but now the external ip address doesn't work (which I guess is obvious).
What I thought I should be able to is reference the file path "home/pi/videos" or something, like you would do with a website, to bypass this problem.
If you suggest any possible solutions, I would be very grateful
No, not so I'm afraid. THe URL has to be relative to the web server and not anything to do with the filing system except that, something like Node-RED's static folder exposes a specific folder as the / URL (unless you change the httpNode setting) and so any sub-folder in that static folder is represented in the URL. So lets say that you set your static folder to /somewhere/ then add a file one.mp4, and you are running node-red on a device with an external (to your local network - ignore the Internet for a sec) IP address of 192.168.1.10, then the URL will be http://192.168.1.10:1880/one.mp4. If you then add a sub-folder /somewhere/my-videos/ and move one.mp4 to there, the URL becomes http://192.168.1.10:1880/my-videos/one.mp4.
Now, with pitunnel, you are creating a special kind of VPN. THe pitunnel service gives you a web address. From their marketing blurb:
Access HTTP tunnels on your own custom pitunnel subdomain. Share your tunnel URLs with friends and family to give them secure access to your projects.
More importantly, since you should NEVER expose anything to the Internet without encrypted links:
Tunnel traffic, web and terminal access securely encypted using TLS & HTTPS.
So the service should give you an external address that you map, via a "tunnel" to the internal address of your Pi. The internal part of the tunnel will be localhost:1880 if you are running the pitunnel application on the pi itself (or 127.0.0.1 if it doesn't let you use localhost) and the external part will be whatever the service lets you set. It doesn't expose its documentation without a login so I can't really help there.