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

Fixed forwarding from spring boot -> vuejs. #154

Closed
wants to merge 1 commit into from

Conversation

dogeared
Copy link

Forwarding from spring boot -> vuejs is currently busted.

Right now, it's handled inside the BackendController which is problematic because (a) it's a RestController and (b) it's only handling /api/** paths since it has a RequestMapping at the top of the class.

This PR introduces a Controller called VueForwardController whose only job is to properly handle the forwarding to the view app in case a user puts a full URL directly in the browser.

@ubaldop
Copy link

ubaldop commented Jan 31, 2021

I think this PR might be very helpful. As a side consideration I am wondering if the regex here could be too much restrictive (e.g. it seems not forwarding routes with more than one token, such as /hello/world/yada/yada). What about to have a route more restrictive like the following?

@RequestMapping({"/{path:[^\\.]*}", "/**/{path:^(?!index\\.html|api|actuator).*}/{path:[^\\.]*}"})

baicaihenxiao added a commit to baicaihenxiao/spring-boot-vuejs that referenced this pull request Feb 9, 2021
@jonashackt
Copy link
Owner

@isneezy also fixed the problem with #92, but that might be more comprehensive. So I went with his solution and will close your PR in favour of #92. Thanks anyway and I hope you test your scenario also with the new version 😃

@jonashackt jonashackt closed this Feb 12, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants