Where to set trusted proxy?

I’m using a reverse proxy on another device/IP, away from a VM that diaspora is running on, is there somewhere in the diaspora configuration that I can add my trusted reverse proxy IP? I’m getting a 502 bad gateway error without it…

To be more specific, I’m running into the exact error as this post but for diaspora. I’m pretty much just needing to add the following to diaspora but I can’t find where.

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 10.0.0.200      

The diaspora* runserver doesn’t really care where a request is coming from. There could be several things that might be going on here:

If you followed the official install guide, and you set up the diaspora* runserver and a reverse proxy on the same machine, this shouldn’t fail at all. nginx also doesn’t care where requests are coming from, and the only thing you should do is set up the http_realip_module to make sure that the target nginx and diaspora* itself see the actual client’s IP instead of your reverse proxy’s.

What I think you do, however, is that you just want to run the diaspora* appserver on a VM, and not an nginx on that machine? If so, note that the diaspora* appserver listens to a local UNIX socket by default. You’d have to change that to listen to an external IP (or 0.0.0.0/[::]) as per the examples in that config.

Note, however, that that’s not really recommended for anything besides a lab-setup - the diaspora* appserver is not designed to serve static files like CSS/JS and uploaded images. In fact, in the production environment, diaspora* will not serve static files, only in development. You can change that behavior in the config, but this isn’t recommended in production. nginx is much faster and more efficient in serving static files.

1 Like

Thank you! You’re absolutely right, the default listen is the correct one and it started working on the default 80 port! :slight_smile: Got it up to speed from there.

The only other thing is, I created the first (admin) account but it won’t let me get into the ruby console to make the account an admin. The known “RAILS_ENV=production bundle exec rails console” run in /home/diaspora/diaspora produces “bash: bundle: command not found”. If I change bundle to bin/bundle, error is then /usr/bin/env: ‘ruby’: No such file or directory

Maybe this is a stupid question, as I just ran other rails command fine before I finished out the install with nginx changes and certbot commands, but yeah it won’t recognize ruby or bundle. I reinstalled ruby 2.7.2 I believe, restarted, same.

Can I make the user an admin via postgresql commands instead? I can’t find any other way to…

Always use bin/bundle instead of a global bundler binary. That’s usually the better thing. :slight_smile:

How did you install Ruby? If you used RVM, make sure to load RVM in your .bashrc, or it won’t find any Ruby. If you’re using ZSH, put that into .zshrc instead, if another shell, adopt as needed.

Yes! But I’m not gonna tell you. Not to be rude, but because directly messing with the diaspora* database can result in the system being in a somewhat-unpredictable state that’s pretty much impossible to debug. Please always use the rails console. If you don’t know how to do something, ask first, we’re happy to help!

1 Like

Thank you sir! By mistake I installed ruby a dir within the user folder instead, fixed. Was able to complete everything after that. Much appreciated!