Forum Discussion

shravanghongade's avatar
shravanghongade
Icon for Nimbostratus rankNimbostratus
Jun 13, 2022
Solved

How to add/configure (redirect the request to another server) server which is not the backend?

How to add/configure (redirect the request to another server) server which is not the backend? I have configured the backend with the Nginx server as a load balancer and added two backend server ins...
  • P_Kueppers's avatar
    P_Kueppers
    Jun 17, 2022

    Sorry for my late reply, I was off my work and had no access to this board. 

    Do you only need to proxy any of those file servers whatever backendserver was choosen or do you need to take fileserver 1 when backendserver 1 was choosen? 

    Otherwise you can simply go with this, or did I missunderstood something?

     

    upstream nginxlb {
    server 10.3.0.7;
    server 10.3.0.14 backup;
    }
    
    upstream fileservers {
    server 10.3.0.20;
    server 10.3.0.30 backup;
    }
    
    server {
    listen 80;
    server_name 10.3.0.16;
    add_header Access-Control-Allow-Origin *;
    
    location /file/path {
    proxy_pass http://fileservers;
    proxy_set_header Host $host;
    }
    location / {
    proxy_pass http://nginxlb;
    proxy_set_header Host $host;
    }
    }