
<VirtualHost *:80>
ProxyPreserveHost On

# Replace with your sub domain
ServerName example.localhost

# Serve user uploaded files and add the Content-Disposition header when the filename
# query param is set.
RewriteCond %{QUERY_STRING} (?:^|&)dl=([^&]+)
RewriteRule ^/media/.* - [E=FILENAME:%1]
Header set "Content-Disposition" "attachment; filename=\"%{FILENAME}e\"" env=FILENAME
ProxyPass /media !
Alias /media /baserow/media
<Directory "/baserow/media/">
    Require all granted
</Directory>


# Properly upgrade ws connections made by Baserow to the /ws path for realtime collab.
RewriteEngine on
RewriteCond ${HTTP:Upgrade} websocket [NC]
RewriteCond ${HTTP:Connection} upgrade [NC]
RewriteRule .* "ws://backend:8000/$1" [P,L,END]
ProxyPass /ws ws://backend:8000/ws
ProxyPassReverse /ws ws://backend:8000/ws

ProxyPass /api http://backend:8000/api
ProxyPassReverse /api http://backend:8000/api

ProxyPass / http://web-frontend:3000/
ProxyPassReverse / http://web-frontend:3000/

</VirtualHost>
