Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix 404 - when url entered directly into the browser #92
Conversation
Pull Request Test Coverage Report for Build 497
|
@@ -52,12 +52,4 @@ public User getUserById(@PathVariable("id") long id) { | |||
return SECURED_TEXT; | |||
} | |||
|
|||
// Forwards all routes to FrontEnd except: '/', '/index.html', '/api', '/api/**' | |||
// Required because of 'mode: history' usage in frontend routing, see README for further details | |||
@RequestMapping(value = "{_:^(?!index\\.html|api).*$}") |
hemeroc
Sep 13, 2020
The forward
in this rule did not work for two reasons
- it was placed int he wrong
RequestMapping
context as it would look for the pattern only after/api
- it was placed in a
RestController
instead of aController
that does not support returning aforwad:/
Although the filter probably does work the easier solution would be to just fix 1) & 2)
isneezy
Sep 25, 2020
Author
Thanks for the info, I didn't knew about it! I'll see if it works and I'll update the PR in the mean time
isneezy
Oct 6, 2020
Author
@hemeroc I've tried to follow your idea, you were right about the using Controller instead of RestController but unfortunately, this solution only works on one level URLs like this /login
but not for this /auth/login
or any URL that has many deep level path as you can see the tests here:
Do you have any idea on how to match URLs with multiple levels?
isneezy
Nov 16, 2020
Author
I've found a way to accomplish using @Controller
instead of Filter
I'll update as soon as possible
I've fixed the White Label error with a simple filter by reusing the existing REGEX
The only catch up with this approach is that if you plan to have other URLs other than
/api
ex:/oauth
etc you'll have to include them in the REGEX expressionFixes #41