asciinema-server
asciinema-server copied to clipboard
Behind Apache httpd Proxy
@sickill - First lots of thanks for Asciinema.
This is not an ideal case but this is what I have:
- A CentOS Linux server running some sites - ports 80 and 443 are in use by regular httpd server.
- I installed
asciinema-server
using docker-compose with following env vars in.env.production
URL_SCHEME=http
URL_HOST=localhost
URL_PORT=18880
- docker-compose.yml - changed exposed port on host to 18880:
ports:
- "18880:80"
- Defined reverse proxy at httpd level at host:
<VirtualHost *:80>
ServerName www.markiv.us
ServerAlias www.markiv.us
DirectoryIndex index.php index.html
SetOutputFilter SUBSTITUTE,DEFLATE
ProxyPass / http://localhost:18880/
ProxyPassReverse / http://localhost:18880/
SetOutputFilter INFLATE;proxy-html;DEFLATE
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|http://localhost:18880/|https://www.markiv.us/|i"
<Proxy *>
Order deny,allow
Allow from all
Allow from localhost
</Proxy>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.markiv.us
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
ServerName markiv.us
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{SERVER_NAME} =markiv.us
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
In above -
SetOutputFilter INFLATE;proxy-html;DEFLATE
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|http://localhost:18880/|https://www.markiv.us/|i"
I needed to add SetOutputFilter INFLATE;proxy-html;DEFLATE
since it appeared that the response was compressed.
So - The site works fine as SSL termination is at the apache httpd level and not at the nginx.
Issue - 1
The issue is - when email comes after login - the url has http://localhost:18880
.
Issue - 2
I tried using the following in .env.production
URL_SCHEME=http
URL_HOST=markiv.us
URL_PORT=80
The email that comes has above URL but asciinema player breaks it does not start.
Is there something that you can suggest for the config or env vars? I am close and thanks for your insight.
I guess it's too late but I'll try :)
This one seems correct to me:
URL_SCHEME=http
URL_HOST=markiv.us
URL_PORT=80
The port number here needs to be one to use for generating URLs, and given you're fronting it all with Apache on port 80 it should work like that.
What error do you get when the player doesn't start with these settings?
@sickill I am facing a similar issue. I'm not using apache but nginx instead. I have a Linux server that runs nginx as a reverse proxy, proxying multiple applications that each run on their own port (they may or may not run in docker containers). Because of that very use case doing rewrites (for the "/") is only possible once so this is a not a valid solution for my use case.
Is it possible to fix the source code instead to use relative paths instead of absolutes for all static/asset information?
This should be fixed at the application level not at a deployment level IMHO. This would fix the original issue with apache as well and no rewrites should be needed.
Big thank you in advance!