简体   繁体   中英

Using x-forwarded-for to fetch google search

I am creating a proxy that compresses data fetched from website before serving to user "browser". Everything works fine except google search. The problem is that even though I transfer IP address of user via X-FORWARDED-FOR , yet I get results based on US (where my servers are located).

I am using PHP curl to fetch pages and have tried setting CURLOPT_HTTPHEADER with X_FORWARDED_FOR , X-FORWARDED-FOR , REMOTE_ADDR and HTTP_X_FORWARDED_FOR with user's IP address, but none helped.

Any idea now how to convince google that my location is eg Japan not US where my servers are located.

Edit: There is a solution using iframe, but that's not the solution that I am looking for. How does any other service which compress website data before delivering solve this problem.

This is how I solved this problem by using user country to find google's country specific search domain and direct the traffic to that domain.

Here is List of google search domains

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