Skip to content

nginx with docker compose #150

@ankitshahit

Description

@ankitshahit

Hi
I m struggling with nginx with docker setup, it keeps filing with csrf.
I looked at django documentation and added csrf_trusted_domain

It didn't work.

Really hoping I can get this fixed.

Here's my nginx confug that acts as a reverse, BTW I have removed nginx that was part of the original docker compose and directly connecting to the pm-app
Also renamed the container to match service name
proxy
location / { proxy_pass http://pm-app:8020; #proxy_pass http://pm-frontend:80/; proxy_set_header Host 127.0.0.1; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_http_version 1.1; client_max_body_size 100M; #proxy_cookie_path / "/; Secure"; #proxy_read_timeout 900; }
Snippet of .pm-env file
Django debug mode. In production off or False is recommended. # Value can be set to: True or False (true enables debug mode. false disables debug mode.) DEBUG=True ALLOWED_HOSTS='wealth.x.com,127.0.0.1' CSRF_TRUSTED_ORIGINS='https://wealth.x.com,127.0.0.1,http://127.0.0.1,wealth.x.com'

Here's the actual error msg

Forbidden (403)

CSRF verification failed. Request aborted.
Help

Reason given for failure:

Origin checking failed - https://wealth.x.com does not match any trusted origins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions