0

i currently have transmission-daemon web ui served by nginx

server {
    listen       2324;
    server_name  torrent.example.com;
    location /rpc {
        proxy_pass  http://127.0.0.1:9091/transmission/rpc;
    }
location /transmission {
        proxy_pass  http://127.0.0.1:9091/transmission;
    }
location / {
        proxy_pass  http://127.0.0.1:9091/transmission/web/;
    }
}

i am trying to display this page via https://github.com/stormpath/stormpath-express-sample this dashboard/user interface

in routes/index.js i have

router.get('/torrent', function (req, res, next) {
if (!req.user || req.user.status !== 'ENABLED') {
return res.redirect('/login');
}
var newurl = 'http://127.0.0.1:2324'
 request(newurl).pipe(res)
});

i see the html when i goto /torrent but no images/css/js i am thinking the request is not the right tool for this purpose could some one offer a better solution

many thanks

Jongware
  • 22,200
  • 8
  • 54
  • 100

3 Answers3

0

Your HTML probably refers to CSS/images/etc using URLs such as /index.css. The browser makes these into fully-qualified URLs that look like http://torrent.example.com/index.css, which is not proxied by ngnix the way you have it set up.

You probably want to either use URLs such as /transmission/index.css for your CSS (when specified in the HTML), or alternatively have a <base> tag in your HTML for that.

Nitzan Shaked
  • 13,460
  • 5
  • 45
  • 54
  • hi i have added `` login.example.com/torrent being where i am viewing the trasmission web ui from still no change i have also changed a few lines to href to "transmission/javascript/etc" still no change – Jack Cowey Jul 24 '14 at 11:51
0

ok so i have made progress with html/css i moved the transmission interface into the express root and imported the html into jade but now i am having a new problem

when i load the /torrent page i can seen in the web console it makes a request to /rpc which i have made a route for

router.get('/rpc|/rpc/', function (req, res) {

var newurl = 'http://127.0.0.1:9091/torrent/rpc/'
 request(newurl).pipe(res)
});

but this comes up with a 404 when i change router.get to router.post i get a 405 error

i have removed the 409 error from transmission so this should work

0

i have solved the issue

i imported the transmission index.html into a jade template i routed /torrent to render that template then i made a new route for /rpc|/rpc/ made that do a post request to the backend transmission-daemon i also changed /js/remote.js to look for the RPC._Root at the atchual domain