Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting host with subpath doesn't work #422

Closed
thegergo02 opened this issue Dec 25, 2020 · 4 comments
Closed

Setting host with subpath doesn't work #422

thegergo02 opened this issue Dec 25, 2020 · 4 comments
Labels

Comments

@thegergo02
Copy link

@thegergo02 thegergo02 commented Dec 25, 2020

Describe the bug

The service is behind an nginx reverse proxy which tries to use a subpath, like this:

location /writefreely/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://127.0.0.1:8080/
    proxy_redirect off;
}

Even if I set the

[app]
host = https://example.com/writefreely

Every link redirects to https://example.com/[actual path] instead of https://example.com/writefreely/[actual path]

Steps to reproduce (if necessary)

  1. systemctl start nginx
  2. systemctl start writefreely
  3. Go to example.com/writefreely
  4. Get greeted with the login page
  5. Click on any link
  6. Get routed to a bad path as described above

Expected behavior

I get redirected to https://example.com/writefreely/[actual path]

Application configuration

  • Single mode or Multi-user mode? Multi-user mode
  • Database? sqlite
  • Open registration? no
  • Federation enabled? yes

Version or last commit: v0.12.0

@thegergo02
Copy link
Author

@thegergo02 thegergo02 commented Dec 26, 2020

I just realised the pages are making the request from JS and they all point to /. Maybe a prefix setting could be a solution? If I can figure it out I might do a PR.

@thegergo02
Copy link
Author

@thegergo02 thegergo02 commented Dec 26, 2020

...or I might just redirect every request that WriteFreely can make with nginx.

@thegergo02
Copy link
Author

@thegergo02 thegergo02 commented Dec 26, 2020

Both of these ways are quite hacky and I don't really want to use them. I noticed that static resources actually follow the path I want, so those show up correctly. (On the login page, in the block every url is correct)
EDIT: and everything that is in the body doesn't use the correct url, even /js/webfont.js

@thegergo02 thegergo02 closed this Dec 26, 2020
@thebaer
Copy link
Member

@thebaer thebaer commented Dec 28, 2020

Thanks for starting this discussion! It's true that WF was never designed to work on a path, so indeed this custom configuration is going to be an uphill battle. If you'd like to see this built in to the software, please feel free to start a discussion on our development forum so we can figure out what needs to be done and coordinate any work on this!

@thebaer thebaer added the not a bug label Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.