Skip to content

Commit

Permalink
Configured CORS and CSRF origins
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel81 committed May 27, 2024
1 parent 3bb6e92 commit cbb7efb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
11 changes: 6 additions & 5 deletions backend/rabbit/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@
DEBUG = True


# ALLOWED_HOSTS = ['rabbit-2ulj.onrender.com']
ALLOWED_HOSTS = ['*']

CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOWED_ORIGINS = [
"https://rabbit-23mo.onrender.com"
]
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
CSRF_TRUSTED_ORIGINS = [
# 'https://rabbit-2ulj.onrender.com',
'http://localhost:5173'
'https://rabbit-23mo.onrender.com',
]
# CORS_EXPOSE_HEADERS = ["Content-Type", "X-CSRFToken"]
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Expand Down Expand Up @@ -123,8 +124,8 @@
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
# 'LOCATION': REDIS_URL,
'LOCATION': 'redis://127.0.0.1:6379/1',
'LOCATION': REDIS_URL,
# 'LOCATION': 'redis://127.0.0.1:6379/1',
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
}
Expand Down
9 changes: 2 additions & 7 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': 'http://127.0.0.1:8000',
'/media': 'http://127.0.0.1:8000',
// '/image': 'http://127.0.0.1:8000',
'/image/': {
target: 'http://res.cloudinary.com/dpzvkmwpb',
changeOrigin: true,
},
// '/api': 'http://127.0.0.1:8000',
'/api': 'https://rabbitapi.onrender.com',
},
},
resolve: {
Expand Down

0 comments on commit cbb7efb

Please sign in to comment.