bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.45k stars 425 forks source link

How can I connect django rest tenant schemas application to a frontend framework using Nginx #654

Open aisamuel opened 3 years ago

aisamuel commented 3 years ago

i want to connect my frontend framework to djano rest tenant schemas using Nginx. How can i go about it? This is what i've done so far

/etc/nginx/conf.d/multitenant.conf

server {

Listen on port 80

listen 80; server_name ~^(www.)?(?.+)$;

Redirect all media requests to a directory on the server

location /media { alias /usr/src/app/example_taxi/media; }

~^(www.)?(.+)$;

Redirect any requests to admin, api, or taxi

to the Django server

location ~ /(admin|student|web|fee|api|quiz|nested_admin) { proxy_pass http://dj:8000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; }

Redirect any other requests to the Angular server

location / { proxy_pass http://ui:4200; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; }

}