factoriotools / factorio-docker

Factorio headless server in a Docker container
https://hub.docker.com/r/factoriotools/factorio/
MIT License
888 stars 218 forks source link

Reverse Proxy Config? #429

Open SnowDrifterr opened 2 years ago

SnowDrifterr commented 2 years ago

I'm using SWAG to manage RP on my webapps.

Been trying to get it to work with Factorio to no avail. I get a can't establish network communication w/ server error from factorio.

I've tried a bunch of different configs to try it, so I'm not sure how helpful it would be to shotgun a bunch of non-working configs here.

Curious if anyone has any that work?

Dawnflash commented 1 year ago

You're dealing with UDP here, proxying UDP is tricky. You need to tell Factorio to bind to a specific IP address on IPv6 (not supported here right now but factorio has a --bind switch). Then nginx:

stream {
    server {
            listen 34197 udp reuseport;
            proxy_pass <host>:34197;
            proxy_timeout 10s;
    }
}
Fank commented 1 year ago

Thanks to @Dawnflash the PR has been merged (5aef1b9f6f3e66949022c1c11e876bcc0de8b443) and is now available in the latest docker tags.