http-party / http-server

a simple zero-configuration command-line http server
MIT License
13.66k stars 1.5k forks source link

How to serve build with homepage property set? #807

Open jacknugent opened 2 years ago

jacknugent commented 2 years ago

In my package json, if I set the homepage like this:

homepage: "/path"

Is there any way to run http-server such that I can run the app from that specified subdomain? Something like localhost:3000/path? Currently, I can only get 404s (as expected) because the app expects to be run at /path

Unfortunately, I cannot simply replace /path with . like the Create React App docs suggest because I am using pushState on IIS:

If you are not using the HTML5 pushState history API or not using client-side routing at all, it is unnecessary to specify the URL from which your app will be served.

Cross posted in serve

zbynek commented 2 years ago

I guess baseDir option proposed in https://github.com/http-party/http-server/pull/294 is what you want.

Alternatively you can create folder build/path and let http-server serve the whole build folder (if you can't change your directory structure, build/path could be just a symlink in your filesystem to the folder with actual content).

github-actions[bot] commented 2 years ago

This issue has been inactive for 180 days