Score:0

nginx reverse proxy gives 400 when defining location

se flag

I want to create a reverse proxy to access my ip camera (10.10.10.31). But for some reason when I try to change my location from "/" to "/cam1" I get a 400 bad request. I can see it is trying to acces 10.10.10.31/cam1 but that does not exist.

How can I make it possible to go to someWebsite/cam1 and then get redirected to 10.10.10.31/

This works:

server {
    listen 50000;
    server_name someWebsite;

    location / {
    proxy_pass http://10.10.10.31/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
    error_log /var/log/nginx/debug.log debug;
}

This does not work:

server {
    listen 50000;
    server_name someWebsite;

    location /cam1 {
    proxy_pass http://10.10.10.31/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
    error_log /var/log/nginx/debug.log debug;
}
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.