Closed tpluscode closed 7 years ago
I understand it works under the assumption that dot signifies static content
yes, true.. this rule prevents requests for static files like app.js
returning index.html
.
In my case the paths are entire URIs
i must admit, yours is a rare use case.. i've seen paths sent in the querystring (e.g. http://localhost:8000/dashboard?path=http://some.uri.in.path
) or POST data, but never as in your case.
How would you like to see this resolved?
i suppose we need the ability to define the pattern which identifies whether a path is for an asset (app.js
) or not (/user/detail/1
).. at the moment, the pattern is "does the path contain a full-stop".. you would require a different pattern..
How would you like to see this resolved?
I expected this to be very simple. For a given path /x/y/z.html
/x/y/z.html
exists return it-spa
parameter valueAnd actually this could be achieved explicitly with the greedy --rewrite /* -> index.html
. You would only need to check that the rewritten path isn't actually a physical file.
How about that?
What you describe was the original behaviour until another user highlighted that a missing asset, e.g. an image or script should fail and return 404. But with the behaviour you described, a request for an image that's currently missing would return the SPA document. Not ideal.
I will find a middle ground to resolve this.
I see how either way can cause trouble. It is true that my current requirement is unusual. I did try to explicitly narrow down the rewrite so that it only matches an URL in path: --rewrite '/http://* -> index.html'
. This however acts just like the greedy pattern. Maybe making it work would make everyone happy for now?
AFAIK koa-connect-history-api-fallback
has an option for rewrites. Not sure if it can help.
I'd rather pass redirect url as a query parameter (actually I do it this way in my current project using SPA).
The url from given example is not a valid url itself, so making it work is unlikely to be a good solution.
this is fixed in v2 of the tool, will let you know when it's ready.
this is resolved by the --spa.asset-test
option in v2 which is in progress and available for preview.
Hi. I would like to use SPA mode to test my app. I my case the paths are entire URIs, for example
When I start the web server with
ws -s index.html
, such requests are not rewritten.ws
logs a message sayingI understand it works under the assumption that dot signifies static content?
I tried
--rewrite /* -> index.html
but this causes any request, even when static files which exist, to respond with index.html.