0

I want to use Pocketbase behind Ngnix as a reverse proxy on my Ubuntu-VPS. I followed the documentation on https://pocketbase.io/docs/going-to-production/.

I wanted to put pocketbase to /api/. When i try to connect to the pocketbase admin panel the browser shows some 404 and a ContentSecurityPolicy Error. It looks like this:

Console Errors

It also seems to be that some HTML is loaded from Pocketbase.

Inspector

This is my current ngnix config (i replaced my domain with test.com)

server {
    listen 80;
    listen 443 ssl;
    server_name test.com;

    ssl_certificate /etc/letsencrypt/live/test.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/test.com/privkey.pem;

    location / {
        try_files $uri $uri/ /index.html;
        root /var/www/html;
        index index.html;
    }

    location /api/ {
        # check http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
        proxy_set_header Connection '';
        proxy_http_version 1.1;
        proxy_read_timeout 360s;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_pass http://127.0.0.1:8090;
    }
}

Pocketbase is started with the default localhost settings on the VPS.

enter image description here

I can even access pocketbase over http://127.0.0.1:8090/api/ when i'm connected via SSH in VS Code and see the requests in the log. (i am surprised that this is even possible. At first i tought i had pocketbase running on my local machine but when i killed the backend on my vps i couldn't access it anymore)

Pocketbase Admin Panel

I hope that somebody can help me out as i can't find much about this in the internet.

ts_97
  • 35
  • 4

1 Answers1

0

Problem solved. It works when append a / to the address at the proxy_pass directive

proxy_pass http://127.0.0.1:8090/;
ts_97
  • 35
  • 4