Skip to content

IpSpoofAttackError for some users after switching from nginx to Thruster #98

@viktorsmari

Description

@viktorsmari

After deploying Thruster to production, some of our customers (most likely behind a corporate VPN or other setup) started seeing our HTTP ERROR 500 page.

Our error tracking software gave us this error (IP addresses changed)
ActionDispatch::RemoteIp::IpSpoofAttackError: IP spoofing attack?! HTTP_CLIENT_IP="5.6.7.8" HTTP_X_FORWARDED_FOR="1.2.3.4"

Before using Thruster, I was using a simple nginx container in front with minimal config that never had this issue
https://github.com/SteveLTN/https-portal

I like using Thruster, because I just add a gem, and instead I can remove 1 Docker container.

We are using docker-compose.yml, these are the relevant parts:

services:
   app: &app_base
     volumes:
       - thruster:/rails/storage/thruster
     environment:
      - FORWARD_HEADERS=0
 
volumes:
  app-postgres:
  thruster:

I added the FORWARD_HEADERS=0 but that did not solve my spoofing issue.

This is probably not Thruster specific issue, but any suggestions or ideas would be welcome.
Maybe Thruster needs another ENV var to remove the HTTP_CLIENT_IP if that conflict is causing this?

This is how I reproduced the issue:

curl -i https://app.mydomain.com/ \
  -H 'X-Forwarded-For: 1.2.3.4' \
  -H 'Client-IP: 5.6.7.8'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions