From 65387952ac421f93b1248f1e7469ca43214e5115 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 20 Aug 2023 14:35:18 -0700 Subject: [PATCH] Add more headers to nginx proxy_pass Mm, something in Rails was getting upset when working with session cookies because the `Host` header was `127.0.0.1:3000` instead of `beta.impress.openneo.net`. I only saw this log entry on important actions like login, so my hope is that this is why login is failing?? I was intentionally omitting these to start, because I didn't understand them well and didn't want to add things I didn't understand. But now I've checked in on them more and they seem standard and reasonable. Ok! ``` HTTP Origin header (https://beta.impress.openneo.net) didn't match request.base_url (http://127.0.0.1:3000) ``` Source: https://stackoverflow.com/a/73198861/107415 --- deploy/setup.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deploy/setup.yml b/deploy/setup.yml index bd85b4c6..0946bb48 100644 --- a/deploy/setup.yml +++ b/deploy/setup.yml @@ -323,6 +323,12 @@ location @app { proxy_pass http://127.0.0.1:3000; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header Host $http_host; + proxy_redirect off; } } dest: /etc/nginx/sites-available/impress.conf