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
gregismotion opened this issue Dec 25, 2020 · 5 comments
Closed

Setting host with subpath doesn't work #422

gregismotion opened this issue Dec 25, 2020 · 5 comments

Comments

@gregismotion
Copy link

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

@gregismotion
Copy link
Author

gregismotion 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.

@gregismotion
Copy link
Author

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

@gregismotion
Copy link
Author

gregismotion 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

@thebaer
Copy link
Member

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!

@rouilj
Copy link

rouilj commented Dec 12, 2022

Was a discussion on this ever opened? I was also trying to put it under a path from my main web domain (at /blog) and had no luck when I found this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants