Skip to content

✨ Configure base path via CLI option #175

Open

Description

@jd-solanki

Hi πŸ‘‹πŸ»

I generally publish my static site under some base path (not directly in root domain). Every time I make a build I have to create a dummy dirs to recreate the subpath environment and serve the site from root to test the site.

Is it possible to provide a base path via CLI option (serve --base "/myapp/") so each file is served like it is in myapp dir.

Thanks.

Activity

  1. lericson commented on May 30, 2024

    @lericson

    +1. I fiddled with this for an hour, only to realize that you cannot do this using just rewrites. You should be able to with path-to-regexp, but it seems that there is a replacement of * for (.*), the reason for which I do not understand.

    Edit: I think it may be to allow minimatch to work as a fallback? It's all very strange.

  2. lericson commented on May 30, 2024

    @lericson

    It seems even if you specify /base/:path+, which does capture the subpath correctly, the rewritten URL will have its slashes escaped and so it will fail.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions