forked from easyquery/DotNetSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: upgrade EqDemo.AspNetCoreStencil.AdvancedSearch to .NET 8.0 #18
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
Open
devin-ai-integration
wants to merge
2
commits into
master
Choose a base branch
from
upgrade/stencil-advancedsearch-to-net8
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Migration to SPA Proxy breaks API calls — Stencil dev server has no reverse proxy for API routes
The old
UseProxyToSpaDevelopmentServer("http://localhost:4444/")kept the browser at the ASP.NET server URL (port 5001) and transparently proxied SPA asset requests to the Stencil dev server. This meant the SPA's relative API calls (/api/easyqueryatClientApp/src/components/easy-query/easy-query.tsx:52,api/data-filteringatClientApp/src/components/filter-bar/filter-bar.tsx:54) resolved against port 5001 and reached the ASP.NET backend. The newMicrosoft.AspNetCore.SpaProxypackage redirects the browser to the SPA dev server URL (http://localhost:4444). Once the browser is at port 4444, those relative API calls go to the Stencil dev server instead of the ASP.NET backend. The Stencil dev server (ClientApp/stencil.config.ts:15-18) has no proxy configuration for/apiroutes, so API calls will fail with 404. The standard .NET 8 SPA templates solve this by configuring the SPA dev server (e.g., Vite) with a proxy for/apiroutes back to ASP.NET — this Stencil setup lacks that.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid point.
Microsoft.AspNetCore.SpaProxyredirects the browser to the SPA dev server URL, so relative API calls (/api/easyquery,api/data-filtering) would go to port 4444 instead of the ASP.NET backend.However, the project already configures an
AllowAllPolicyCORS policy that allows any origin, so API calls from port 4444 to the ASP.NET backend will succeed if the SPA uses absolute URLs or if a proxy is configured on the Stencil dev server.The Stencil dev server (
stencil.config.ts) doesn't currently support a built-in proxy configuration like Vite or webpack-dev-server do. Options to address this in a follow-up:/api/*to the ASP.NET backendhttp-proxy-middlewarein a wrapper dev server scriptThis is a dev-time ergonomics concern — production builds served from
ClientApp/wwwvia the ASP.NET server will work correctly since both SPA and API are on the same origin.