0

I am setting up a nginx as a reverse proxy to an external site and I am getting 502 Bad Gateway response for my requests. This is my reverse proxy config

server {
    listen       80;
    server_name  iframe.test;
    location ~\/oracle\/(.+) {
        # root   /var/www/html/iframe;
        # index  index.html index.htm;
        proxy_set_header Host $host;
        proxy_set_header Access-Control-Allow-Origin *;    
        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  https://www.oracle.com/$1;
        proxy_hide_header 'x-frame-options';

    }
    error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

Can you point out what is wrong here? I have worked with Apache earlier, but I'm bit new to nginx.

Here is my error.log when made a request to iframe.test/oracle/index.html

2017/09/28 15:47:08 [error] 7880#7880: *2 no resolver defined to resolve www.oracle.com, client: 127.0.0.1, server: iframe.test, request: "GET /oracle/index.html HTTP/1.1", host: "iframe.test" 2017/09/28 15:47:09 [error] 7880#7880: *2 open() "/etc/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: iframe.test, request: "GET /favicon.ico HTTP/1.1", host: "iframe.test"

Can you point out what is wrong here? I have worked with Apache earlier. So I'm bit new to nginx.

  • Why are you using Nginx, a reverse proxy, instead of something like squid which is a proxy server? – Tim Sep 28 '17 at 7:53
  • What does your nginx error log show? – Tero Kilkanen Sep 28 '17 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.