Welcome! Log In Create A New Profile

Advanced

Does reverse proxy work with everything?

Posted by rwebb 
Does reverse proxy work with everything?
May 06, 2022 05:30PM
Hello,

My first post on this forum so hello everyone!

I'm just wondering if it's possible to use Nginx to reverse proxy pretty much any web site/application? I am trying to proxy my SuiteCRM version 8.1.0 and it appears to work. I get to the login screen and I can log in but when I select on any of the menu options I get a metadata error. Through troubleshooting I found a graphql networking error that says "500 bad gateway" and this does not happen when I connect directly to the app on port 8080 behind the proxy.

I've posted on SuiteCRM's forum as well asking for help. I was able to successfully put version 7.10.10 behind Nginx but they must have made some changes in the latest version requiring me to adjust something.

Any ideas or information needed? Here is my config:

server {
listen 80;
server_name crm.xxxxxxx.com;
return 301 https://$host:443$request_uri;
}

server {
listen 172.16.21.2:443 ssl http2;
server_name crm.xxxxxxx.com;
client_max_body_size 0;
underscores_in_headers on;


ssl_certificate /etc/nginx/ssl/crm.xxxxxxx.com.crt;
ssl_certificate_key /etc/nginx/ssl/crm.xxxxxxx.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;

proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 64;

proxy_buffering off;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_set_header X-Forwarded-Host $server_name;
proxy_pass http://172.16.21.4:8080;
allow all;
}

}

This is the same config I am using with the other older instance of SuiteCRM that works.

Rich
Re: Does reverse proxy work with everything?
May 08, 2022 02:20AM
According to "500 bad gateway", I think you are using proxy_pass to the wrong place or the url doesn't exist.
I guess this line is cause of the error. proxy_pass http://172.16.21.4:8080; <-- this ip_address looks like the virtual ip address. try to curl that to test you can reach this ip_address from you the place you use nginx.

If you have Discord id, please leave it. Or Send me a friend request BoMBx#3070 and direct message to me.
Re: Does reverse proxy work with everything?
May 08, 2022 11:29PM
I actually got it working - it was an issue with buffer settings. I added the following and it started working:

proxy_busy_buffers_size 512k;
proxy_buffers 4 512k;
proxy_buffer_size 256k;

I now have a weird problem where if I log out and type credentials to log back in it says my session is expired and just flips me back to the login screen. I have to close and reopen the window.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready