kanishka-linux / reminiscence

Self-Hosted Bookmark And Archive Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support serving reminiscence using subdirectories

Aerex opened this issue · comments

commented

I wanted to created a pull request on this but I was not completely sure if this is actually a problem or an issue on my configuration. Initially, I attempted to run the service against a subdomain called bookmark. Here is the nginx location configuration that I am using.

  location /bookmark {
     rewrite ^/bookmark/(.*)$ /$1 break;
     proxy_pass http://localhost:8002;
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_cookie_path / /bookmark;
     proxy_set_header X-Script-Name /bookmark;·
     alias /home/aerex/Documents/repos/git/reminiscence/reminiscence;
  }
  location /bookmark/static {
     alias /home/aerex/Documents/repos/git/reminiscence/reminiscence/static;
  }

Login works but any other links simply forward to root resulting into a 404. I look into the code to see that the base urls are generated dynamically for each user and directory.

A solution would be to simply add in the subdirectory if the FORCE_SCRIPT_NAME setting is set or is passed in as a request header. Any other suggestions?

commented

I look into the code to see that the base urls are generated dynamically for each user and directory.

yes, it is the reason why it won't work by simply modifying nginx config file.

Currently only way it can be done is by allowing users to add custom root_url_location in settings.py and then manually change urls.py file. It will require lot of changes and can break things arbitrarily.

I've pushed few commits in testing branch, to show how it can be done. You can fiddle with the code, and make pull request against that branch. Make sure to run tests and add few more if you think necessary.

commented

Alright thanks I will look into it.

commented

In settings file, a new variable ROOT_URL_LOCATION has been added. Once it has been set to some value like '/bookmark', then all url locations will be set relative to it. There is no need to modify urls.py or nginx config files.

commented

Ah thanks. I was all over the place this week so you beat me to it lol. I will just close this issue