0

I'm trying to run my meteor app behind a proxy on Apache. For example, my app is deployed on http://internalserver:3000, and I would like access it externally from address http://www.mycompany.com/myapp. So, I made a proxy from http://www.mycompany.com/myapp to http://internalserver:3000. When I open the internal URL ( http://internalserver:3000 ), everything works fine. The problem is with the external URL.

I've configured Apache, and all seems to be correct, but my app is not rendering. I get a blank page without any error on console. Apache logs don't show anything out of the ordinary. Everything appears to be loaded correctly, as you can see below:

enter image description here

My Apache configuration is:

ProxyPass /myapp http://internalserver:3000
ProxyPassReverse /myapp http://internalserver:3000

RewriteCond %{QUERY_STRING} ^meteor_js_resource=true
RewriteRule ^/(.*) http://internalserver:3000/$1 [R]

RewriteCond %{QUERY_STRING} ^meteor_css_resource=true
RewriteRule ^/(.*) http://internalserver:3000/$1 [R]

ProxyPassMatch ^/sockjs/info(.*) http://internalserver:3000/sockjs/info/$1

ProxyPassMatch ^/sockjs/(.*)/xhr http://internalserver:3000/sockjs/$1/xhr

ProxyPassMatch ^/sockjs/(.*)/websocket ws://localhost:3000/sockjs/$1/websocket

My Meteor Environment is:

HTTP_FORWARDED_COUNT=1
MONGO_URL=mongodb://mongo:27017/tasks
ROOT_URL=http://www.mycompany.com

OBS.: I think the problem is related to the use of subpath. Example: mycompany.com/myapp. If a redirect from root URL (without myapp) everything works fine

  • 1
    There are no errors on both (server and client) consoles? When I look at your `MONGO_URL`, I just might to ask if you don't authenticate (could cause errors) or even use no authentication at all (worse!). Regarding the apache settings: It is important that you also set up for http 1.1 and allow websocket connections which are a primary parts of meteor. Maybe this helps you: https://stackoverflow.com/questions/27662868/meteor-ddp-ssl-apache-proxy-connection#33466065 – Jankapunkt Nov 22 '17 at 19:38
  • There are no errors on consoles. The mongo is authenticated. Everything works fines when access the internal URL. the problem occurs when I open the external URL. I think the problem is related to the use of subpath. Example: http://www.mycompany.com/myapp. If a redirect from root URL (without myapp) everything works fine. – rodnei couto Nov 23 '17 at 13:51

1 Answers1

0

I guess ROOT_URL should be http://www.mycompany.com/myapp in your case.

schnell18
  • 290
  • 5
  • 8