App proxy with internal IP does not replace IP in html code
-
So I have a box directly connected to my cloudron box, 10.0.0.1-10.0.0.2 ip with a simple webserver serving pages and images.
I install an app proxy app on my cloudron using the app url (http://10.0.0.2/)
Now when I go to my app.proxydomain.com hosted on cloudron it loads the html nicely, but not the pictures as they are still served with the http://10.0.0.2/img.jpg src in the html instead of also getting proxied to http://app.proxydomain.com/img.jpg.
Any quick way to fix this?
-
One way to fix this would be to update the HTML on the webserver to use the proxied URL (http://app.proxydomain.com/img.jpg) for the images, rather than the direct URL (http://10.0.0.2/img.jpg).
Another option would be to use relative paths for the images in the HTML.
Another option would be to configure the proxy app to rewrite the URLs of the images to the proxied URL.
-
@Kubernetes said in App proxy with internal IP does not replace IP in html code:
Another option would be to use relative paths for the images in the HTML.
yes, it is in general a good practice to use relative urls in web projects.
-
-
-
@matthijs that's not possible because HTML/Javascript is opaque "data" and one cannot replace things without understanding what the data is.
For example, the HTML could say "Your IP is NOT xxxxx" or "Your friend is at IP yyyy" or just about anything else. There is no way to reliably replace HTML (other than the app itself).