django-vite icon indicating copy to clipboard operation
django-vite copied to clipboard

403 Error after build

Open getdodam opened this issue 1 year ago • 1 comments

I am building a monolith platform of django backend and vue frontend with vite (django-vite). For authentication, I am using session authentication on django side and vue can get user info by djoser or template props (?).

When in DEV mode (localhost:8000 for django server and localhost:5173 for vue), no issues of any axios calls(GET, POST, PATCH etc...) to django backend. After building the vue files with css, I placed them in Nginx reverse proxy server. All of the axios calls have been rejected with 403 errors. If I typed the api address on browser address window, DRF is working fine.

Originally, I did not used corsheader library because django and vue are same origin, but I installed to allow everything. Nothing works. Please help me what could be a solution?

getdodam avatar Apr 16 '23 13:04 getdodam

This sounds like a problem with Cross-Origin headers, not really with either Vite or Django-vite.

Could you provide a reproducible example?

thijskramer avatar May 09 '23 13:05 thijskramer