-
Notifications
You must be signed in to change notification settings - Fork 267
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
Localhost plugin failed to solve the problem of sending http requests in build production #1602
Comments
In dev mode those requests are handled by your frontend server already, that's why it's working there. |
Thanks for your advice. So is there any easy way to solve this problem of http apis not working in build mode. I tried to use the fetch api provided by tauri http but I think it was too disrupting a job to rewrite so much apis, or perhaps I should try to sidecar somehow following your instrutions. Or Tauri v2 solved this problem? |
Ah, sorry! In fact this application isn't in ssr, the problem is either about the http requests, and I seemed to find the real problem. When I am in dev mode, the webpack serves and helps me do some reverse proxy job to send the requests to the backend in production. While in build mode, I don't have such a backend server to do some reverse proxy.
I believe I could run a actix or axum backend server to do the reverse proxy job when I build my production release to pass the cors security wall. |
Hi, everybody. I am in Windows and I used axios to successfully send http api requests in dev mode. When I am in build mode, my api requests failed.
I refered to this issue and properly configured the
tauri-plugin-localhost
The config file:
when I am in dev mode, the http api request succeeded like this
while I am in build mode, the http api looked this. I only got a error page html back
From my perspective, the only difference between these two requests is their remote address. In build mode, the remote address is in ipv6 format. I don't know the reason and effect somehow.
Here is my tauri info
The text was updated successfully, but these errors were encountered: