Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] Help with self-hosted Nginx reverse proxy #1170

Open
maxacarvalho opened this issue Jun 13, 2024 · 4 comments
Open

[HELP] Help with self-hosted Nginx reverse proxy #1170

maxacarvalho opened this issue Jun 13, 2024 · 4 comments

Comments

@maxacarvalho
Copy link

Hi, I'm using the self-hosted version.

Describe the bug
I'm having an issue while trying to serve the service using Docker compose and Nginx as reverse proxy. I'm getting a 400 Bad Request error.

My config is pretty simple, here's the docker-compose.yml file:

services:
  app:
    restart: always
    image: getfider/fider:stable
    ports:
      - "8000:3000"
    environment:
      BASE_URL: http://localhost

      DATABASE_URL: REDACTED

      JWT_SECRET: REDACTED

      # From which account e-mails will be sent
      EMAIL_NOREPLY: REDACTED

      EMAIL_AWSSES_REGION: us-east-1
      EMAIL_AWSSES_ACCESS_KEY_ID: REDACTED
      EMAIL_AWSSES_SECRET_ACCESS_KEY: REDACTED

And here's the Nginx config:

server {
    server_name  roadmap.nicksaudelabs.com;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/roadmap.nicksaudelabs.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/roadmap.nicksaudelabs.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    client_max_body_size 100m;

    location / {
        proxy_buffering off;
        proxy_request_buffering off;
        proxy_pass_request_headers on;
        proxy_pass http://localhost:8000;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header Host $host;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;
        proxy_pass_header   Set-Cookie;
        proxy_read_timeout 10m;
        proxy_send_timeout 100m;
    }
}


server {
    if ($host = roadmap.nicksaudelabs.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name  roadmap.nicksaudelabs.com;
    listen       80;
    return 404; # managed by Certbot
}

I'm not sure how to start debugging at the moment. The logs give me nothing 😢

I appreciate any help. Thanks.

@maxacarvalho maxacarvalho added the type: bug something is broken, we need to fix it label Jun 13, 2024
@mattwoberts
Copy link
Contributor

Hope you don't mind me removing the bug label - since we have many users hosting it this way without issue.

DId you get anywhere?

@mattwoberts mattwoberts removed the type: bug something is broken, we need to fix it label Jul 8, 2024
@Webstijlen
Copy link

I think your proxy pass needs to point to the internal port:

proxy_pass http://localhost:3000;

@easaw
Copy link

easaw commented Nov 30, 2024

I found that the base URL needs to be 'https://feedback.example.com' rather than just 'feedback.example.com' otherwise the front-end links end up being https://feedback.example.com/feedback.example.com/assets/whatever.js for example.

@mattwoberts
Copy link
Contributor

There is some info about that at https://fider.io/docs/hosting-instance - it is something that seems to catch a few people out:

image

I wonder if we need to make this clearer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants