I got troubles to deploy my android app using apache proxy, either problems with the domain name or CORS restrictions… After having swapped domain names and configurations from different commands, I made it works the way I want:
My app works on https://interesting-links.luteciacorp.org/ and the android client works well although this error appearing regularly:
(android:http://localhost:12512/__cordova/packages/webapp.js:37) Error: ROOT_URL in downloaded asset bundle would change current ROOT_URL to localhost. Make sure ROOT_URL has been configured correctly on the server.
It is safe for that URL to be accessible. The mobile app has to access that URL to work. If you don’t want users accessing that URL to view what is available in your app, you can opt to use Meteor.isCordova() checks to ensure that only user with the mobile app can see the content.
My concern is mostly this one: Is it possible for an attacker to do something using the app directly through port 3000 which could lead to an intrusion in my server or something similar ?
Your ROOT_URL is wrong, that’s why you have CORS issues. Why are you setting it to localhost, when your root URL is https://interesting-links.luteciacorp.org/? I mean that’s what the error says! It’s telling you that’s the issue!
I’d recommend Traefik, it might be easier for you to understand and it handles creating an SSL certificate for you automatically with ACME.
Because it doesn’t work with https://interesting-links.luteciacorp.org, I have actually CORS issues when I set this as ROOT_URL and it disappeared when I set it to localhost:3000 then I reverse proxy. I tried all the combinations possible before and this last one works although this error Make sure ROOT_URL has been configured correctly on the server which sounds more like a warning to me.
Why shouldn’t I use apache ? I already have a website running on it (/var/www/html/ main domain name), I’d like to put my app server on /var/www/interesting-links/ because the structure seems simple and I already got to know apache config files.
Could you explain me with more details if you have a better idea to make it works properly in a simple way ?
From Traefik website:
Traditional reverse-proxies require that you configure each route
that will connect paths andsubdomains to each microservice.
In an environment where you add, remove, kill, upgrade, or scale
your services many times a day, the task of keeping the routes up
to date becomes tedious.
I’m trying to say you’ve misconfigured Apache. I’m not sure how to configure it correctly, but it’s definitely misconfigured. I mean, clearly it is, because it’s not working right?
It’s rewriting the Host to appear that they’re from localhost:3000 (i.e., the place where Apache is running, which is totally reasonable). So when a CORS (OPTIONS) request is made, the server thinks it’s okay, but the client code knows it’s actually being served from a real domain. This is why your ROOT_URL variable appears to be misbehaving.
Because it’s full of pitfalls, and tutorial for it are really a collection of things-that-work for people as opposed to some cogent narrative about how it works.
Well, if this actual configuration doesn’t have any security issue, as long as it works I guess it’s better to settle with apache for now. I barely know nginx but I’m open to suggestions.