简体   繁体   中英

AWS ELB with WCF and X-forwarded headers

My end goal is to see a client's external IP addresses in IIS log files for reporting/troubleshooting.

We have a WCF application running on EC2 instances behind an Elastic Load Balancer. I have the F5 ISAPI DLL installed in IIS. The load balancer is setup to use HTTPS(443) forwarding to HTTPS(443). There is a valid certificate hosted on the ELB and a self-signed certificate on IIS.

In this scenario, if I access a page such as https://mysite/test.html , the IIS log will contain an external IP address. But when I access https://mysite/wcfapplication/test.aspx , the IIS log contains the internal IP address of the ELB.

Amazon says this is an issue with the application. The team is having problems determining what to change in the WCF configuration. Has anyone encountered this scenario and found a fix/workaround?

The reason for this is due to the fact that when you work with a Load Balancer it passes the data along and the IP address of the request becomes that of the load balancer. The users actual IP address is recorded in the "x-forwarded-for" server variable.

In IIS you need to use a third-party ISAPI filter to record that value, when it is found in the request, which will make things work.

There are a few, this one created by a guy from F5 - Or this one from a member of the Microsoft IIS team .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM