Page 1 of 2
how to redirect Transmission 1.34 to port 80?
Posted: Tue Oct 07, 2008 7:00 pm
by akumajo
Hello
here my current and working setup:
* apache webserver running a website on port 80 (my.site.com)
* transmission webserver running on port 9091 (my.site.com:9091/transmission/web/)
what i want to do is to have access to transmission webserver on port 80 (my.site.com/transmission/web/) but my other webserver must also works on port 80
is possible ? any idea ?
thanks
Re: how to redirect Transmission 1.34 to port 80?
Posted: Wed Oct 08, 2008 5:20 pm
by rb07
Yes, its possible.
You have to configure Apache to do it, and there are many ways to go about it:
- Define a redirection alias: "Redirect /transmission/web/ http://my.site.com:9091/transmission/web/"
- Configure and use Apache as proxy, which has the advantage of not having to open the 9091 port to the Internet
- Use rewrite rule... complex way to control what gets proxied.
The first one just make Apache reply with a redirection to the real link, is a sort of short notation but nothing changes underneath.
The proxy is the more interesting, I use something similar (but with Squid) combined with a ssh tunnel. Since I have Squid, I haven't used Apache's proxy capabilities and don't know much about how to define the correct alias that will make the proxy communicate with transmission-daemon and how does that work with the constant chatter the Web client does.
You'll get a better answer at the Apache user's list (or documentation which you may have already installed, try
http://my.site.com/manual).
Re: how to redirect Transmission 1.34 to port 80?
Posted: Fri Oct 10, 2008 1:38 am
by Azquelt
I've just spent a while finding out how to do this.
If you have transmission running on the same computer as Apache, enable the following modules:
Ubuntu and Debian users probably just need to run
Then add the following to your apache config file:
Code: Select all
ProxyRequests Off
<Proxy *>
Order Allow,Deny
Allow from all
</Proxy>
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission
This lets Apache work as a reverse proxy, forwarding requests to the transmission directory to localhost:9091 and back again. (I'm not sure that the ProxyPassReverse line is necessary for transmission as it should only be needed if it uses absolute URLs).
You can put any authentication directives in the <Proxy> block
You should then be able to access the transmission interface at
http://mydomain/transmission/web
If that's too long for you, you can add a redirect to your apache config like this:
Code: Select all
Redirect permanent /torrents https://mydomain/transmission/web
My whole config file for the ssl side of my web server looks like this:
Code: Select all
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot /var/www/gnat
SSLEngine on
SSLOptions +ExportCertData +StrictRequire
SSLCertificateFile /etc/ssl/certs/apache.crt
SSLCertificateKeyFile /etc/ssl/private/apache.key
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/gnat>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ProxyRequests Off
<Proxy *>
Order Allow,Deny
Allow from all
AuthType Basic
AuthName Transmission
AuthUserFile /etc/apache2/users
Require user me
</Proxy>
Redirect permanent /torrents https://mydomain/transmission/web
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
Edit: 2008-12-06 -- Added the bit about loading modules
Edit: 2009-05-10 -- Added where to access the transmission interface after setting up apache
Re: how to redirect Transmission 1.34 to port 80?
Posted: Sat Oct 11, 2008 9:06 am
by akumajo
thx you, it works !
Re: how to redirect Transmission 1.34 to port 80?
Posted: Tue Nov 11, 2008 1:45 pm
by bluey
Well i made the changes but the WebUI is messed up. What could i have made wrong?
Re: how to redirect Transmission 1.34 to port 80?
Posted: Tue Nov 11, 2008 2:38 pm
by pea
bluey wrote:Well i made the changes but the WebUI is messed up. What could i have made wrong?
it looks like stylesheet (stylesheets/common.css) is missing or improperly linked or not accessible..
Re: how to redirect Transmission 1.34 to port 80?
Posted: Tue Nov 11, 2008 5:33 pm
by bluey
Well the WebUI itself is working as it should. Only the redirection is broken.
here is my vhost config
<IfDefine SSL>
<IfDefine SSL_DEFAULT_VHOST>
<IfModule ssl_module>
Listen 443
<VirtualHost _default_:443>
ServerName mythtv
DocumentRoot /var/www/localhost/htdocs
SSLEngine on
SSLOptions +ExportCertData +StrictRequire
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
<Directory /var/www/localhost/htdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AuthType Basic
AuthName Transmission
AuthUserFile /etc/apache2/users
Require user myself
</Directory>
ProxyRequests Off
<Proxy *>
Order Allow,Deny
Allow from all
AuthType Basic
AuthName Transmission
AuthUserFile /etc/apache2/users
Require user myself
</Proxy>
ProxyPass /transmission
http://localhost:9091/transmission/web/
ProxyPassReverse /transmission
http://localhost:9091/transmission/web/
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
</IfModule>
</IfDefine>
</IfDefine>
# vim: ts=4 filetype=apache
Re: how to redirect Transmission 1.34 to port 80?
Posted: Thu Nov 27, 2008 8:42 pm
by Azquelt
That should be
Code: Select all
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission
This is important because the web interface also has to be able to access /transmission/rpc to actually communicate with the daemon.
Re: how to redirect Transmission 1.34 to port 80?
Posted: Sat Dec 06, 2008 12:07 pm
by Azquelt
Edited my instructions above to include loading the necessary modules.
Thanks to Abe on IRC.
Re: how to redirect Transmission 1.34 to port 80?
Posted: Sat Dec 06, 2008 1:46 pm
by wereHamster
For lighty, use the following configuration. You can remove the 'auth' block, I use it so that only authorized users can access the web interface. I know transmisson itself can do authentication, but I'd rather keep all the access control in one place (lighty) instead of scattered all over the web services.
Right now the URL has to be /transmission, it's not easily possible to have the Web UI under a different URL. This will change once
ticket 1538 is merged into trunk. Then you'll be able to have the Web UI under any URL you wish.
Code: Select all
server.modules += ( "mod_rewrite", "mod_auth", "mod_proxy" )
url.rewrite-once += ( "^/transmission[/]?$" => "/transmission/web" )
$HTTP["url"] =~ "^/transmission/" {
auth.backend = "plain"
auth.backend.plain.userfile = "/var/www/transmission/users"
auth.require = (
"" => (
"method" => "digest",
"realm" => "Transmission Web Interface",
"require" => "valid-user"
)
)
proxy.server = (
"" => (
(
"host" => "127.0.0.1",
"port" => 9091
)
)
)
}
Re: how to redirect Transmission 1.34 to port 80?
Posted: Sun May 10, 2009 2:13 pm
by didrocks
Hi,
Just tried the same thing, but can't access to transmission webinterface one redirected by the apache proxy :
I go to
http://services.mydomain.com and then, get the crendential ask (so, that seems to mean that the redirection is performed succesfully), but then, I got a 404 error…
Accessing directly to the webinterface by
http://192.168.0.1:9091 works…
Here is the file used :
Code: Select all
<VirtualHost *:80>
CustomLog /var/log/apache2/access_stat.log combined
DocumentRoot /home/data/www/www/
ServerName services.mydomain.com
Options -Indexes FollowSymLinks
Alias /munin/ /var/www/munin/
Alias /munin /var/www/munin/
<Directory /var/www/munin/>
Options FollowSymLinks
AllowOverride None
#authentification
AuthType Basic
AuthName "Private stat access"
AuthUserFile /home/data/www/.htpasswd
require valid-user
</Directory>
Alias /piwik/ /home/data/www/piwik/
Alias /piwik /home/data/www/piwik/
<Directory /home/data/www/piwik/>
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
ProxyRequests Off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
I just got this in access.log (nothing in error.log)
192.168.0.254 - - [10/May/2009:16:08:03 +0200] "GET /transmission HTTP/1.1" 401 32 "-" "Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10"
192.168.0.254 - - [10/May/2009:16:08:03 +0200] "GET /transmission HTTP/1.1" 404 32 "-" "Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10"
Any idea?
Thanks!
Re: how to redirect Transmission 1.34 to port 80?
Posted: Sun May 10, 2009 2:44 pm
by Azquelt
Re: how to redirect Transmission 1.34 to port 80?
Posted: Sun May 10, 2009 3:05 pm
by didrocks
Thanks a lot, I get now the interface, but…
I
can't upload torrent file (it does nothing when uploading),
I
can see numbers changing (peers, downloading rates) ,
I
can interact with existing torrent (pausing/resuming), but I got regularly some "Connection Failed. Could not connect to the server. You may need to reload the page to reconnect." error (let's say, after 10 seconds) and then, no refresh.
Strange, seems that transmission web connexion is dropped by apache?
All works like a charm from the same browser and PC using
http://192.168.0.1:9091
Re: how to redirect Transmission 1.34 to port 80?
Posted: Mon May 11, 2009 6:48 pm
by didrocks
Strange, it's working today
My apache seems to be happier !
Thanks a lot for this great software.
Re: how to redirect Transmission 1.34 to port 80?
Posted: Thu Jun 24, 2010 7:16 pm
by paf.goncalves
Hi!
I'm trying to configure Apache, my config is:
Code: Select all
ProxyPass /transmission http://localhost:8080/transmission
ProxyPassReverse /transmission http://localhost:8080/transmission
It asks for password, i can login, but then it gives error:
Code: Select all
409: Conflict
Your request had an invalid session-id header.
To fix this, follow these steps:
When reading a response, get its X-Transmission-Session-Id header and remember it
Add the updated header to your outgoing requests
When you get this 409 error message, resend your request with the updated header
This requirement has been added to help prevent CSRF attacks.
X-Transmission-Session-Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Did this hapended with any of you ?