<div dir="ltr">Hi Team,<div><br></div><div>I am already setting below headers.</div><div>server 1</div><div>server_name <a href="http://abc.com">abc.com</a>;</div><div> access_log /var/log/nginx/abc.access.log;<br> error_log /var/log/nginx/abc.error.log warn;<br>location /abc {<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> proxy_set_header Host $http_host;<br> proxy_pass_header X_CUSTOM_HEADER;<br> proxy_pass <a href="https://1.1.1.1/abc">https://1.1.1.1/abc</a>;<br><br>}</div><div><br></div><div>Backend Server</div><div><br></div><div>server_name <a href="http://def.com">def.com</a>;<br></div><div> access_log /var/log/nginx/def.access.log;<br> error_log /var/log/nginx/def.error.log warn; <br></div><div> location /abc {<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> proxy_set_header Host $host;<br> proxy_pass <a href="http://1.1.1.1/abc">http://1.1.1.1/abc</a>;<br><br> }<br></div><div><br></div><div>server_name <a href="http://ghi.co.com">ghi.co.com</a>;</div><div> access_log /var/log/nginx/ghi.access.log;<br> error_log /var/log/nginx/ghi.error.log warn; <br></div><div> location /xyz {<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> proxy_set_header Host $host;<br> proxy_pass <a href="http://1.1.1.1/xyz">http://1.1.1.1/xyz</a>;<br><br> } <br></div><div><br></div><div><br></div><div>If I enable this Nginx Config, the virtual hosts on the Backend server like <a href="http://ghi.co.com">ghi.co.com</a> are logging with the requests coming to <a href="http://def.com">def.com</a></div><div><br></div><div>Can you let me know,what I am missing and why I am facing incorrect logging requests to the file /var/log/nginx/ghi.access.log.</div><div><br><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Thanks & Regards<br>Sathish Kumar.V</div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 24, 2019 at 7:35 AM Sathish Kumar <<a href="mailto:satcse88@gmail.com">satcse88@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Hi Rozitis,</div><div dir="auto"><br></div><div dir="auto">Thanks for your reply.<br><div dir="auto"><br></div><div dir="auto"><br></div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Thu, May 23, 2019, 10:58 PM Reinis Rozitis <<a href="mailto:r@roze.lv" target="_blank">r@roze.lv</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Instead of IP address, if we use FQDN with https, do we have to validate the SSL certificate on Proxy_Pass?. <br>
<br>
By default the certificate validation is turned off (and nginx just uses the ssl for traffic encryption). <br>
If needed you can enable it with proxy_ssl_verify on; ( <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_verify" rel="noreferrer noreferrer" target="_blank">http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_verify</a> )<br>
<br>
<br>
> Due to IP address, multiple sites on the server Nginx access log logging the same requests.<br>
<br>
If you do the logging on the backend server (and there are multiple virtualhosts) and proxy_pass is via <a href="http://ip" rel="noreferrer noreferrer" target="_blank">http://ip</a>, then you need/have to pass also the Host header.<br>
<br>
Either by passing the Host header from original request:<br>
<br>
proxy_set_header Host $host;<br>
<br>
or you can specify a custom one:<br>
<br>
proxy_set_header Host "some.domain";<br>
<br>
<br>
<br>
> Is the above Nginx config, correct way of doing it?.<br>
<br>
Depends on your setup and what you want to achieve.<br>
<br>
<br>
For example if your location blocks match the request on the backend you can omit the URI in the proxy_pass directive:<br>
<br>
location /abc {<br>
proxy_pass <a href="https://1.1.1.1" rel="noreferrer noreferrer" target="_blank">https://1.1.1.1</a>;<br>
}<br>
<br>
rr<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" rel="noreferrer" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div></div></div>
</blockquote></div>