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

Can't figure out to configure to serve a virtual path #111

Open
zshlomyz opened this issue Dec 31, 2019 · 4 comments
Open

Can't figure out to configure to serve a virtual path #111

zshlomyz opened this issue Dec 31, 2019 · 4 comments

Comments

@zshlomyz
Copy link

Hi,
I would like the server listen to a virtual path / base-path like this - localhost:/.
I used the rewrite property but I didnt found a way that serve the index.html file when accesing without postfix while serving the other files.
My configuration:
{ "rewrites": [ { "source": "/virtual-path", "destination": "/index.html" }, { "source": "/virtual-path/:rest", "destination": "/:rest" } ] }

Please help,
Thanks

@chasen-bettinger
Copy link

Anybody familiar with this? I cannot figure it out..

@Chili-Man
Copy link

Chili-Man commented Jun 27, 2020

@chasen-bettinger You can use the fragments feature like this:

{
  "rewrites": [
    {
      "source": "path/you/want/:asset",
      "destination": ":asset"
    }
  ] 
}

@whazlewo
Copy link

I am struggling with this same issue, and I've not found the correct set of google terms to answer this :-)

I want to serve a folder "my_site" but I want to prefix it so that the url would be http://some_prefix/some_folder/

I tried this

rewrites: [{source: "my_prefix/:path", destination: "/:path"}]

and then ran serve ./my_html_files which has my static content in it

It almost works

If i navigate to http://localhost/my_prefix/some_folder I see directly listing, but if i try to go to index.html i get nothing :-[

What do i need to do to serve a folder, and have it appear to be under some other folder on a virtual path?

@whazlewo
Copy link

I tried this based on a thread above and it does not seem to work either:

{
  "rewrites": [{ "source": "some_virtual_prefix/:path+", "destination": "/:path(.+)" }]
}

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

No branches or pull requests

4 participants