mboinet / ttrss-mobile

A mobile webapp for Tiny Tiny RSS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Hosted on same domain name" note not completely true

ralscha opened this issue · comments

The readme states that ttrss-mobile " should be hosted on the same domain name." Without additional configuration this true, but with a simple .htaccess file it is possible to install ttrss-mobile in any domain you want.

My ttrss is installed on http://rss.mydomain.com. I wanted ttrss-mobile install on http://mrss.mydomain.com. After setting everything up the browsers throws a cross-origin resource sharing exception and that is expected.

If ttrss is running with an Apache web server this is easy to solve. I only had to copy this .htaccess file into the ttrss/api folder and everything works.

Header set Access-Control-Allow-Methods "POST, OPTIONS"
Header set Access-Control-Allow-Origin "http://mrss.mydomain.com"
Header set Access-Control-Allow-Headers "Content-Type"

My conf.js looks like this:

window.apiPath="http://rss.mydomain.com/";
window.webappPath="http://mrss.mydomain.com/";

Not sure if I set the window.webappPath variable correctly. But it looks like everything works.

You set it right.

You're totally right about the cross-origin thing. I didn't want to test this and I think that there were only a few people interested in this. You're proving me wrong ;-)

I'll update the README and point to your post & a litte doc on MDN I find good: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS

Doc updated

Great writeup. Just a little tip on the .htaccess use of Header. If you don't have the Apache Headers module enabled, you'll see an error in the log:

Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

Enable the module with:

sudo a2enmod headers

Is this still supported?

At least, the variables:

window.apiPath="http://rss.mydomain.com/";
window.webappPath="http://mrss.mydomain.com/";

Don't exist any more in the latest release.

I assumed that just setting:

apiPath: "http://rss.mydomain.com/"

Would be enough, in collaboration with the .htaccess changes, but it doesn't seem to work in my installation.

False alarm. It actually seems to work just setting:

apiPath: "http://rss.mydomain.com/"

And the .htaccess changes aboves.

Sorry for the noise, and thanks for your awesome work :)