You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
I've been testing whitebird for the past few days and wanted to put it behind a reverse proxy. While testing, I found some things that confused me a bit when implementing it.
I'm using docker and one of the things that got me was how the client is expected to connect to the backend. I know nothing about webapps, so yea.
This caused some confusion because CORS does not allow for the browser to create HTTP requests for different domains. Since my configuration was not 100% in agreement with the idea of the client acessing backend, the browser simply blocked the request due to the URL used to access the main webpage (frontend) being different to the URL accessed when trying to open a new whiteboard (backend).
I was at first curious why the docker-compose had mapped ports (40000:5000 and 40001:3001) because docker is designed in a way that its really simple to provide communication between containers (As used in the backend/db communication) and so I didn't see the need for a backend port being mapped. After the situation described above I understood that this port was actually necessary for the client.
Trying to tie that with the idea of reverse proxying the application, I started testing some different configurations and got it working. I'm sharing below my configuration for docker-compose.yml, backend.env, the frontend Dockerfile as well as the labels necessary to use traefik for reverse proxying it in a way that the client will use only one encrypted URL and avoiding mapping ports at all.
Just a reminder that you would need a A or AAAA entry in your DNS zone pointing to the traefik's IP. My traefik entrypoints are called http and https and it may differ in your environment. Also replace domain.tld with your domain.
Docker-compose.yml
Note the main changes below: All containers are configured in a docker network called proxy, the port mappings being disabled, as well as labels for traefik.
The objective here is to make traefik route everything from URL whitebird.domain.tld to the frontend container. Now, if the URL whitebird.domain.tld is accompained by the URI /whiteboard or /socket.io, it actually routes it to the backend container.
In the frontend Dockerfile, since from the POV of the client, you will always request things to the same domain, you can basically replace API_URL, SOCKET_URL and FRONTEND_HOST to the same URL
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Hope y'all doing great.
I've been testing whitebird for the past few days and wanted to put it behind a reverse proxy. While testing, I found some things that confused me a bit when implementing it.
I'm using docker and one of the things that got me was how the client is expected to connect to the backend. I know nothing about webapps, so yea.
This caused some confusion because CORS does not allow for the browser to create HTTP requests for different domains. Since my configuration was not 100% in agreement with the idea of the client acessing backend, the browser simply blocked the request due to the URL used to access the main webpage (frontend) being different to the URL accessed when trying to open a new whiteboard (backend).
I was at first curious why the docker-compose had mapped ports (40000:5000 and 40001:3001) because docker is designed in a way that its really simple to provide communication between containers (As used in the backend/db communication) and so I didn't see the need for a backend port being mapped. After the situation described above I understood that this port was actually necessary for the client.
Trying to tie that with the idea of reverse proxying the application, I started testing some different configurations and got it working. I'm sharing below my configuration for docker-compose.yml, backend.env, the frontend Dockerfile as well as the labels necessary to use traefik for reverse proxying it in a way that the client will use only one encrypted URL and avoiding mapping ports at all.
Just a reminder that you would need a A or AAAA entry in your DNS zone pointing to the traefik's IP. My traefik entrypoints are called http and https and it may differ in your environment. Also replace domain.tld with your domain.
Docker-compose.yml
Note the main changes below: All containers are configured in a docker network called proxy, the port mappings being disabled, as well as labels for traefik.
The objective here is to make traefik route everything from URL whitebird.domain.tld to the frontend container. Now, if the URL whitebird.domain.tld is accompained by the URI /whiteboard or /socket.io, it actually routes it to the backend container.
backend.env
This file is pretty much the same.
frontend/Dockerfile
In the frontend Dockerfile, since from the POV of the client, you will always request things to the same domain, you can basically replace API_URL, SOCKET_URL and FRONTEND_HOST to the same URL
Beta Was this translation helpful? Give feedback.
All reactions