Astalaseven / twitter-rss

Rss-generator for Twitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set application path

PoGo606 opened this issue · comments

Hello, I'm trying to configure twitter-rss to work behind a reverse proxy.
https://f.q.d.n/twitter-rss => http://internal.host:5000

I would be great to be able to set a root path to the application.
I tried to solve this problem using Apache's mod html_mod_proxy, unfortunately some redirect are not correctly rewritten.

Thanks in advance !

I'm not sure it will help, but you may change the server.py file:

if __name__ == "__main__":
    app.run(host='0.0.0.0')

to

if __name__ == "__main__":
    app.run('localhost', 80)

You will need root privilege to use the port 80.
You can check flask documentation, it is the module used to create the webserver: http://flask.pocoo.org/docs/api/

Thanks for you reply,

Well, I already set the listener settings as desired. The only missing settings is the root path.
I already had a look to the flask documentation, and I couldn't find a suitable configuration settings, but I surely missed something...

Anyway I managed to make it works using the following Apache configuration:

ProxyPass /twitter-rss http://local.server.ip:5000
RewriteRule ^/twitter-rss$ twitter-rss/ [R]
<LocationMatch ^/twitter-rss>
    ProxyHTMLURLMap / /twitter-rss/
    ProxyHTMLEnable On
    ProxyHTMLExtended On
    ProxyPassReverse /
    RequestHeader    unset  Accept-Encoding
</LocationMatch>

And changing in server.py, lines 18 and 24,
from: path = request.path
to: path = 'twitter-rss' + request.path

The simpliest way to make it usable on your-server:80/twitter-rss/ should be by placing the twitter-rss directory into /var/www/, and changing the server.py by replacing host='0.0.0.0' by (f.q.d.n, 80).

The problem with path = request.path is if path == 'user': and elif path == 'htag': line 40-42.