Twake on Docker behind Apache Proxy

Hi,

All twake servers run on a docker on one virtual machine and Apache is running on another virtual machine all on the same physical server…
I read the documentation https://doc.twake.app/configuration/custom-domain-and-https to setup Apache Proxy.
Everything works well thank you, except the messages which are not immediately available by the reader. The messages will appear only if the reader refresh the screen… And I continuously get you are offline…

The container port configuration of twake_nginx_01 is: 8086 -­> 80. When I connect directly to the dockerserver:8086 everything is working well including the message… But does not work if it goes through the apache proxy.

Any Idea ? Is there a proxy location missing ?

Regards,

@asw20 We ran into a similar issue, but using Nginx as a reverse proxy.
It turned out to be due to proxy_redirect and proxy_buffering.

This is our working Nginx reverse proxy for Twake config, perhaps you can adapt it to work for your Apache proxy:

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 0;
    proxy_redirect off;
    proxy_buffering off;

# extra  options
add_header X-Frame-Options "SAMEORIGIN";

And maybe, if this is up to Twake’s standards, this could be added to the docs for an Nginx reverse proxy example.

@fvanlint I’ve install on local ok follow by https://doc.twake.app/installation, I want to Custom domain + HTTPS, I follow https://doc.twake.app/configuration/custom-domain-and-https but can not find this folder to edit /etc/nginx/site-enabled/default. I’ve still follow the last doc and my site only go online by mydomain.com:8000 and not https and run very slow. How can I do to put online with Custom domain + HTTPS?

Hello @huuich, the docs that you are referring to assume that you already have a proxy running, or want to set one up.
From your response, I think you do not yet have a reverse proxy running.

You can do that with a number of tools, but a pretty easy one is https://github.com/jc21/nginx-proxy-manager.
That gives you (yet another) web interface that you can use to set the proxy as you want it. This tool generates the applicable nginx reverse proxy config for you.

A minimal config would look like this:
(you should change the ip to match your situation)

domain name mydomain.com
protocol     forward ip       port
http         10.0.10.5        8000

You might also want to enable caching, block common exploits and enable websockets, and that should give you a working starting point. You can add the settings mentioned in an earlier post in advanced to get a bit better speed and responsiveness.
If you also want a lets encrypt certificate, that tool also gives you an easy way to generate one, but that is very dependent on your situation and the tool is pretty self explanatory.

I hope that helps you get started!

1 Like

@fvanlint Thanks for introduce nginx-proxy-manager, it’s a pretty tool. I’ve install this tool on my server ok. And I’ve set website like this

After that, I’ve follow by 🏗️ Installation - Twake and 🔗 Custom domain + HTTPS - Twake but not successful go online by https://mydomain.com it’s show error: 502 Bad Gateway
openresty

I’ve tried to use your config above in Advance of proxy host but still not access twake from website. How can I do? Thanks!
How can I do next

I can access from my domain now, change 127.0.0.1 to my server ip is ok. Thanks @fvanlint
Seems applications and connectors not full like n8n not there? https://doc.twake.app/how-to-use-it/applications/connectors/n8n

/etc/nginx/site-enabled/default

location / {
proxy_pass http://127.0.0.1:8000;
}

location /socketcluster/ {
proxy_pass http://127.0.0.1:8000/socketcluster/;

this magic is needed for WebSocket

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_connect_timeout 7d;
proxy_send_timeout 7d;
proxy_read_timeout 7d;
}

So I’ve pasted the according configuration for configuration/frontend/environment.ts and configuration/backend/Parameters.php. What else do I need to get twake working via the nginx-proxy-manager? nginx-pm is already running and serving content to specific subdomains, but for some reason it doesn’t want to forward twake.
The simple steps @fvanlint recommended weren’t enough.
Any help?