Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in subdir behind reverse proxy #4546

Closed
Huljo opened this issue Oct 5, 2016 · 9 comments
Closed

Not working in subdir behind reverse proxy #4546

Huljo opened this issue Oct 5, 2016 · 9 comments

Comments

@Huljo
Copy link
Contributor

Huljo commented Oct 5, 2016

Rocket.Chat version: 0.42.0 / Manual CentOS install / NGINX

I can't run Rocket.chat in a subdir.
My ROOT_URL=https://domain.com/chat
When I attempt to load rocket chat from https://domain.com/chat I get this response : 'Unknown path".

When I set My ROOT_URL to "https://domain.com/" I just get a loading status forever, assets are all absolute URLed to '/'.

My Nginx config (rocket.chat is running at localhost:3000) :

    location /chat/ {
       proxy_pass          http://127.0.0.1:3000/;
    }

Seems pretty similar to #2646 and #4460 but none of the proposed solutions are working for me.

@Huljo
Copy link
Contributor Author

Huljo commented Oct 6, 2016

Tested on 0.43.0. Same problem.

@Huljo Huljo changed the title Not working in subdir with reverse proxy Not working in subdir behind reverse proxy Oct 11, 2016
@Huljo Huljo changed the title Not working in subdir behind reverse proxy Not working in subdir behind reverse proxy [15$] Oct 11, 2016
@alvarow
Copy link

alvarow commented Oct 11, 2016

+1 ...

@Huljo
Copy link
Contributor Author

Huljo commented Oct 12, 2016

There is one trick:
My nginx conf:

location / {
    if ($arg_meteor_css_resource = "true") {
        rewrite ^ /chat/$uri last;
    }
    if ($arg_meteor_js_resource = "true") {
        rewrite ^ /chat/$uri last;
    }

    location /sockjs {
        rewrite ^ /chat/$uri last;
    }
}

source: forums.meteor.com

@Huljo
Copy link
Contributor Author

Huljo commented Oct 13, 2016

Thanks to @abernix from Meteor project (issue) for pointing out that if settings.CDN_PREFIX is defined, setBundledJsCssPrefix helper is used to rewrite urls and not bundledJsCssUrlRewriteHook, the default implementation. So subfolder can't be set before URLs during boilerplate template instantiation. I'm not using settings.CDN_PREFIX so I'm actually trying to remove it.

@Huljo Huljo changed the title Not working in subdir behind reverse proxy [15$] Not working in subdir behind reverse proxy Oct 13, 2016
@MaluNoPeleke
Copy link

Has this problem already been solved?

@Huljo
Copy link
Contributor Author

Huljo commented Oct 28, 2016

No, I actually set my path as a CDN_PREFIX to serve my assets.

@MaluNoPeleke
Copy link

Can you describe how you did that?

@Huljo
Copy link
Contributor Author

Huljo commented Oct 31, 2016

Open mongo shell on your server and type (replace [...] by your values):

> use [ROCKETCHAT_DATABASE_NAME]
> db.rocketchat_settings.update({ "_id" : "CDN_PREFIX"}, {value: "/[SUBDIR_PATH]"})

This is not a fix, just a dirty way to access your app with the actual release on a subfolder, voice calls/file uploads still not working.

CDN_PREFIX is not supposed to be used to access to your subfolder but like I said above Rocketchat is using it by default (even when value is empty) instead of the meteor webapp default implementation that is properly adding the complete path before each URL using __meteor_runtime_config__.ROOT_URL_PATH_PREFIX.

Huljo added a commit to Huljo/Rocket.Chat that referenced this issue Nov 2, 2016
@Huljo Huljo closed this as completed Nov 7, 2016
@alvarow
Copy link

alvarow commented Dec 1, 2016

Seems fixed on 0.46.0! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants