OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
561 stars 134 forks source link

nginx reverse proxy configuration settings #260

Closed sintaxx closed 3 years ago

sintaxx commented 3 years ago

i've decided to run OFSM without HTTPS/SSL because i've already a running docker start server a reverse proxy with SSL/TLS and i'm having troubles getting the OFSM UI to render correctly when it's served via a reverse proxy, can someone let me know what the required settings it needs might be ? such as proxy_set_headers, etc

i tried using proxy_set_header Content-Length ""; which fixed the weird page rendering issue but it won't accept any data such as the password, i get unexpected end of JSON input error

knoxfighter commented 3 years ago

In theory it should just work fine. I've never done reverse proxying with nginx. I can give it a try, if you give me your setup files (docker-compose.yml, conf.json, nginx.cond, etc).

mroote commented 3 years ago

@sintaxx could you post your current nginx configuration?

sintaxx commented 3 years ago

ok so i finally figured it out and it's working great, except for a couple things...

When i try to use the "download all mods" function i get a "502 bad gateway" error, i'll paste my proxy-conf for my FSM subdomain i think i need to add another location directive with /api in it? i'm not 100% sure.

also, if i try to upload a mod i get an error 'service not available' from FSM as well as getting the same error if i try to access "Logs"

server { listen 443 ssl; listen [::]:443 ssl;

server_name fsm.*;

include /config/nginx/ssl.conf;

client_max_body_size 0;

location / {

    include /config/nginx/proxy.conf;
    resolver 127.0.0.11 valid=30s;
    set $upstream_app fsm;
    set $upstream_port 80;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range;

}

}

here is the block from my docker-compose

factorio-server-manager: image: "ofsm/ofsm:latest" container_name: "fsm" hostname: fsm restart: "unless-stopped" environment:

mroote commented 3 years ago

We used to use nginx as the reverse proxy in the docker setup that might be useful to refer too. There was a separate location block for the /api routes with a few extra proxy settings that you might want to give a shot.

Checkout the config here for reference: https://github.com/OpenFactorioServerManager/factorio-server-manager/blob/0.8.1/docker/nginx.conf

Omaha2002 commented 3 years ago

maybe related to #261?

mroote commented 3 years ago

Oh good point that 502 error is likely fixed in the latest develop container now.

mroote commented 3 years ago

@sintaxx have you had a chance to test the latest version to confirm your issue is resolved?

mroote commented 3 years ago

This should be fixed in the newest version, just reopen the issue if you're still running into this error.