-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Allow devServer to serve cleanURL #603
Comments
😄 I was just about to open an issue on this, would be a great API! Btw, just as a quick add on, I noticed that having a path serve as a page and as a directory works only if a trailing slash is used: '/articles' => Returns only <Root> component, empty page but not a 404 Perhaps this can be addressed with this issue as well... |
@ulivz I think surge's rule for handling this is pretty straightforward: https://surge.sh/help/using-clean-urls-automatically For request
|
@Gangwolf |
@octref Awesome! Maybe I need spend time researching whether all other mundane uses can also support such features, e.g. Github Pages / netlify. |
Netlify also supports it https://www.netlify.com/docs/redirects/#trailing-slash I do think GitHub support it too. |
Cool, let's plan for it. |
Isn't there a drawback to this though? The redirects on the webhosts will cause a full page reload. This is not really what we want. Because the dev servers behavior will differ from the deployed sites behavior, and it won't be able to take advantage of client side routing. Wouldn't it be better to generate a file structure for clean URLs when building? So that the site enables clean URLs by default, to take advantage of the client side routing. |
@octref Hey, My opinion of the issue is same to you! |
@meteorlxy
|
I don't understand why it matters how the URL looks in devServer. You can set this up in prod easily if you wish. |
IMHO, introducing this might incur unnecessary complexity in the URL resolving logic. I prefer to keep this simple and straightforward. |
It's not just how the URL looks. It's how the devServer behaves. For me, I prefer to organize subpages like this:
But now when I request If I organize my file like this:
It at least works on devServer, but now I end up with URL with ugly trailing slashes. |
FWIW, Firebase supports this too through the It would be great to have the dev server support “clean URL” behavior as available on all these hosting platforms. |
Before actually starting to support this feature, I created a PR: feat($core): redirects for clean urls as a transition solution. |
Fixed. |
Feature request
What problem does this feature solve?
When requesting
/about
, serve/about.html
without redirect.What does the proposed API look like?
In config.js, have
cleanURL: true
by default.When enabled, it will serve Clean URL like surge.sh or zeit's serve.
How should this be implemented in your opinion?
Some rule rewrites in the webpack-serve or koa part.
Are you willing to work on this yourself?
Don't have enough time, sorry.
The text was updated successfully, but these errors were encountered: