-
Notifications
You must be signed in to change notification settings - Fork 37
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
Middleware intercepts /api and other requests #111
Comments
Hi. Try to move the line Something similar happened here #12 |
Hi @Eptagone, thanks for getting back so quickly. I moved the call to UseViteDevelopmentServer to be just before app.run() but unfortunately I still see the problem. I suspected something with URL rewriting earlier in the pipeline:
but commenting out these lines made no difference. If you need more details I'll be happy to provide. |
Hi @lordfeck. Mmm, I'll try to reproduce it at some point. But if you happen to have a minimal reproduction repo on hand, I would appreciate it, it would be faster. |
Hi again @Eptagone, if there are certain files of interest I'll be able to pull them out of the main repo and on to a public one. I could extract Program.cs as well as the vite app root, along with anything else that's needed for building a minimal reproduction. Will let you know when it's up. |
Aren't you missing fallback route on server endpoint configuration to point to Home/ErrorDev? |
@micpog We've this line:
Which has been working for error pages before. The problem is that the call to Interestingly @Eptagone when I disable the middleware by calling Maybe if I switch the asset directory to be nested instead of the root it will fix it. If I've no luck I'll get the minimal repro repo up fr you to play with. Thanks again for your time. |
@Eptagone I have the repo up now: https://github.com/lordfeck/VueViteSampleApp. Same code but stripped to the minimum. It all works so is a simple case of checking it out and building then running it. There is also a further description of the problem + my aims which may help, let me know if you need anything else! |
In my case, I need to push some constraint in my mapping : I'm not sure if it's correspond to your usecase |
Hi,
I'm using the extension and have it set up in Program.cs like this:
My web app uses Razor MVC pages in a few places - currently login and a legacy UI. We also use plain HTML Razor to serve the error page and log 404s and other abnormal requests. We wish to keep the Razor/MVC pages for login and 404s, it suits us because the app is split into 2 sections:
The vite app has two entry points that 'boot' from a Razor page (eg, /client/ui, /mynd/ui), and I have this working successfully. I also have routing configured to redirect all requests under this route to Vite, so the webapp handles the routing from there. All as expected.
Yet it seems to intercept other requests - /api, and anything that should show my 404 page. Instead of showing the api route, or showing the 404 on other routes that don't fall under the two SPA routes I get the default Vue/Vite page, aka index.html in the Vite/SPA root directory:
I don't want it to do this, instead it should either serve a 404 page as indicated by
app.UseStatusCodePagesWithReExecute("/Home/ErrorDev", "?statusCode={0}");
or the API route. Is it possible to tell the middleware that everything not under the /client/ui and /mynd/ui routes should not be intercepted and should instead be routed to ASP.NET MVC?The text was updated successfully, but these errors were encountered: