cors.Options{
AllowedOrigins: []string{"http://localhost:*"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"},
AllowCredentials: false,
MaxAge: 300, // Maximum value not ignored by any of major browsers
}
#Request to server Go backend server fails from my frontend app, success from anywhere else
32 messages ยท Page 1 of 1 (latest)
How would i allow all origins ?
from the internet
Okay i have an issue I don't know if it comes from Go
Request to my go server gets refused from my svelte app
azureuser@myvm:~$ curl http://localhost:8080/server
{"address":"127.0.0.1","ip":"127.0.0.1","port":"8080","zone":""}
fails in the browser, works with curl
http://localhost:8080/server also works from the browser when i put in the external IP of my vm
also from postman
Request to server Go backend server fails from my frontend app, success from anywhere else
Currently have cors.AllowAll
Can you show how you apply the middleware?
If it's an azureVM i'm guessing you're not using the browser in a UI, so are you connecting from a remote system
if so localhost won't work from the frontend for obvious reasons
Oh that's an interesting point, i thought maybe it was the server running in the VM connecting to the API internally but maybe the call is from the browser
maybe i'm just that stupid
Okay it can connect but now i have cors issues
fetcher.js?v=2c1678e5:44 Uncaught (in promise) TypeError: Failed to fetch
at window.fetch (fetcher.js?v=2c1678e5:44:10)
at register (auth.ts:32:25)
at HTMLFormElement.submit (Register.svelte? [sm]:10:26)
at HTMLFormElement.<anonymous> (index.mjs:420:19)```
Yeah i need sleep ๐ but thanks for pointing it out
says you can't use the wildcard if you include credentials (cookies)
you can still use https://* and http://* afaik?