Nginx reverse proxy issue

Hello,

I’m not an nginx user, so my error could be basic, but I am looking for some help.

I have a VPS which I have spun up with the sole purpose of hosting a rasa server. Lets call it chat.example.com

I have my normal website, and on one of the page, I want to call the chatbot. I do this using the rasa web widget. Lets call this example.com

If I set the websocket on example.com to http://chat.example.com:5005, the widget works fine.

However, as this will be a production bot in future, I want the call on example.com to be to: https://chat.example.com:5006

(I’m using 5006, as 5005 is being used by rasa).

To this end, I’ve set up nginx using the following:

server {

  listen 5006 ssl;
  server_name chat.example.com; 
 

    ssl_certificate /etc/letsencrypt/live/[REDACTED]/fullchain.pem; # managed by Certbot 
    ssl_certificate_key /etc/letsencrypt/live/[REDACTED]/privkey.pem; # managed by Certbot

 
    location / {
        proxy_pass http://0.0.0.0:5005;
        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_redirect https://0.0.0.0:5006 http://0.0.0.0:5005;
    }

}

However, the calls aren’t making it to rasa server.

When I edit the underlying call to be to http://chat.example.com:5005, it works fine so the server is running correctly. I think the issue is with nginx.

Can anyone help?

as usual - fastest way to solve your own issues us to ask for help in public.

When I altered the port to 5006, I forget to open that in the firewall. And spent the next two hours looking for an error in good code.

The above script seems to be good for what I am trying to do, but if this is wrong approach or if there is something I am missing, I’d love to hear it.

It seems like you’re encountering an Nginx reverse proxy issue while trying to set up your Rasa server. Your setup looks pretty close, but there might be a small configuration detail causing the problem. For those not familiar with Nginx, these issues can indeed be a bit tricky. If you’re still having trouble after checking your Nginx configuration, you might want to explore solutions to ensure smooth proxying. If you need reliable proxy services for various tasks, you can Buy proxy. Quality proxies can be a valuable resource in troubleshooting issues like this and ensuring your server and applications work seamlessly.