Closed kfo1182 closed 6 years ago
If you’re running Postleaf locally, the solution is to include the port number in APP_URL in your .env file:
APP_URL=http://localhost:3000/
This only affects local installs, as most production installs are proxied behind Nginx or Apache.
I certainly do the same thing on the production server. However, if there is an .env variable - why not use it? It wouldn't break reverse proxying, since nginx internally adresses node app with a port specified, but will fix the dev-server deployment. Current version of .env
seems to be confusing. PS: Thank you, now I have a fully functional dev server, so it isn't my issue anymore. You can read this comment as a rhetoric question.
It’s because APP_URL is strictly used to generate URLs.
Postleaf has no way of knowing whether not the port should be included in the URL (not all dev environments will require it.)
This has been a point of confusion for some people but I’m not sure what the best solution is. Open to ideas!
For any practical reason, do you have to know APP_URL to generate href
s for stattic assets? Do I miss something, or could you refactor .env
variables in the following way: APP_URL
dissapears, since you can always link static assets relatively to the host, or ask your node.js instance what the host is.
If there is a need to run postleaf in a domain subfolder, you could create an APP_DOMAIN_SUBFOLDER
var (i.e. =/blog/
), and concatenate it with relative urls.
APP_HOST
and APP_PORT
stay what they are - settings to start up a node.js server.
Whatever the .env
format gonna be, it may be helpful to leave some comments in .env.example
.
Sorry if overlooked something obvious and am just wasting your time.
There are a handful of reasons we need to know the host (password reset emails, for example).
In the PHP version of Postleaf (now forked and called Leafpub), we moved to schemaless URLs but that change was reverted for the same reason.
Again, maybe .env
isn't the best place for it. Maybe the proxy should be required to pass the hostname to the app (but then you'd still need to make it available in dev somehow). This approach just seemed practical at the time.
Closing this as the solution is mentioned above.
Summary
CSS links in a fresh install don't include the port number. To make them work, one should either edit the code by hand, or start postleaf on the port 80 - with sudo.
Steps to Reproduce
href="{@url...}"
in views withhref="/..."
resolves the problem.Additional info
Note: This issue tracker is ONLY for bug reports and feature requests. If this is a personal support issue, please visit postleaf.org/support.