Skip to content

Update nginx configuration #34

Description

@mStirner

The old nginx revers proxy configuration has a error, that query parameter are not passed to the API:

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}

server {

    listen 80;
    server_name 127.0.0.1 localhost open-haus.lan open-haus.local;

    # remove server version
    server_tokens off;


    root /opt/OpenHaus/frontend;

    try_files $uri $uri/ =404;
    index index.html;

    autoindex off;    

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    location ~ /(api|auth)/(.*)$ {
        proxy_pass http://127.0.0.1:8080/$1/$2;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }


#    location ~ /(.*)$ {
#        proxy_pass http://frontend:3000/$1;
#        proxy_http_version 1.1;
#        proxy_set_header X-Forwarded-Proto $scheme;
#        proxy_set_header Connection $connection_upgrade;
#        proxy_set_header Upgrade $http_upgrade;
#        proxy_set_header Host $host;
#        proxy_set_header X-Real-IP $remote_addr;
#        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#    }

}

Update location block:

    location ~ ^/(api|auth)/ {
        proxy_pass http://127.0.0.1:8080$uri$is_args$args;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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