Nginx Reverse Proxy

Hello,

I currently have site where I proxy certain locations using nginx. Up until now I have had the subA and subB where the main site, subA, proxied through cloudflare and subB on DNS ONLY. The set-up has worked fine. I have decided to add subB to cloudflare for security reasons however I get the below error.

My nginx set-up is as follows;

 location /subA/location {
                proxy_pass https://subB/location;
                proxy_redirect off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_ssl_verify_depth 2;
                proxy_http_version            1.1;
                proxy_pass_header X-CSRFToken;
                proxy_ssl_protocols TLSv1.2;
                proxy_ssl_server_name on;
                proxy_ssl_name subB/location;

I am hoping that someone can point me in the right direction. I can access both sites directly, both have dedicated CERTS and also, again, when subB is not proxied - it works absolutely fine.

How did you add SubB to Cloudflare DNS? It should be an “A” record with the IP address of your origin server.

Hi,

Thanks for your reply - yes; I did that.

Interestingly I have added a page-rule to disable security on SubB and it is now working.

I think I’m probably happy with that assuming that the ‘disable security’ doesn’t override general DDoS.

1 Like

So I understand correctly, you have suba.example.com set :orange:, and the Origin is your Nginx server. You are reverse proxying from there to subb.example.com, which is also :orange:. Is the subB using the same origin?

I haven’t setup a test, but I would guess that the looping protection is kicking in. Cloudflare can see that this request has already passed through CF, and will not allow it to go through a second time.

This should be a hostname?

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.