Skip to main content

Command Palette

Search for a command to run...

Apache Reverse Proxy For Penpot Docker Web Socket

Updated
1 min read
H

I am a developer from Malaysia. I work with PHP most of the time, recently I fell in love with Go. When I am not working, I will be ballroom dancing :-)

Penpot is an open source alternative for Adobe Figma. I self-host Penpot using Docker (instructions), and setup Apache web server as reverse proxy.

Unfortunately Penpot only provide configurations for Nginx, but not Apache. This is what I added within <VirtualHost> to make it work.

Prequsite: Make sure these modules are loaded: mod_proxy, mod_proxy_http, mod_proxy_wstunnel, mod_rewrite.

# Reverse proxy for websocket
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule /(.*) ws://127.0.0.1:9001/$1 [P,L]

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:9001/
ProxyPassReverse / http://127.0.0.1:9001/

RemoteIPHeader X-Real-IP
RemoteIPHeader X-Forwarded-For
RequestHeader set X-Scheme expr=%{REQUEST_SCHEME}
RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}

If you change the Penpot Frontend port number, make sure you change the configurations above accordingly. The websocket and proxy configurations are important, configuring of HTTP headers are optional.

More from this blog

Hong's Tech Blog

110 posts

The blog is older than you know. I prefer counting from the emergence of one integral anomaly to the emergence of the next, in which case this is the forth version.