Blank page when running Meteor behind a proxy


#1

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:

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

OBS2.: this is a repost from stack overflow: https://stackoverflow.com/questions/47435709/blank-page-when-running-meteor-behind-a-proxy