zine icon indicating copy to clipboard operation
zine copied to clipboard

Support sites with `url_path_prefix` in the development server

Open Arnau478 opened this issue 5 months ago • 0 comments

The way the development server is invoked, it has no way to know what the url_path_prefix is. It's mostly fine, but it causes incorrect behavior in the following scenario.

Have a site with a url_path_prefix with the value prefix. Create an index page, that does a $link.page('foo'). It can be accessed at localhost:<port>/ (not localhost:<port>/prefix/). When zine built the page, $link.page('foo') resolved to /prefix/foo (which makes sense). But now, there's a link that points to localhost:<port>/prefix/foo, which is not where the development server is serving the page.

I think this should be solved by simply passing the url_path_prefix as an argument to the development server and serving it with that prefix. The only problem that would introduce is that now nothing is served at localhost:<port>. Maybe it could return a 301 moved permanently to redirect to localhost:<port>/prefix, for convenience?

Arnau478 avatar Sep 07 '24 00:09 Arnau478