# Discourse behind reverse proxy and https

**URL:** <https://meta.discourse.org/t/discourse-behind-reverse-proxy-and-https/148705>\
**Category:** Self-hosting\
**Created:** [April 21, 2020, 6:58am UTC](https://meta.discourse.org/t/discourse-behind-reverse-proxy-and-https/148705 "2020-04-21T06:58:13Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![Thomas\_Rother](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thomas_rother/32/423597_2.png) [@Thomas\_Rother](https://meta.discourse.org/u/Thomas_Rother)\
**Post date:** [March 12, 2022, 6:47pm UTC](https://meta.discourse.org/t/discourse-behind-reverse-proxy-and-https/148705/18 "2022-03-12T18:47:03Z")

</div>

I migrated our discourse to a new setup and now have problems with **http 403 on POST session** during the login. I would guess a CSRF problem, but right now I have no idea where to start the debugging and /var/log/discourse-var-log/production.log and production\_error.log all have 0 bytes …

Any ideas how to debug this properly?

The current setup:  
**1. haproxy as central https load balancer/accelerator (for both discourse and other services)**

```plaintext
forum >> develd apache rev. proxy p.82
backend forum-backend
   mode http
   server forum.netzwissen.de 10.10.10.14:83 cookie A check
   http-request set-header X-Forwarded-Port %[dst_port]
   http-request add-header X-Forwarded-Proto https if { ssl_fc }
   # HSTS header, 16000000 seconds: a bit more than 6 months
   http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"

```

**2. local apache as rev proxy**

```
   <IfModule proxy_module>
    ## <https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247>
    ProxyPreserveHost On
    # ProxyRequests Off     
    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
    RequestHeader set X-Real-IP expr=%{REMOTE_ADDR}
    ProxyPass / unix:/var/discourse/shared/web-only/apache.http.sock|http://localhost/
    ProxyPassReverse / unix:/var/discourse/shared/web-only/apache.http.sock|http://localhost/
    </IfModule>

```

**3) Discourse operating with separate web\_only and data containers, web\_only deployed with - “templates/web.socketed.template.yml”**

---

_[View the full topic](https://meta.discourse.org/t/discourse-behind-reverse-proxy-and-https/148705)._
