Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix for multiple chained hosts in HTTP_X_FORWARDED_HOST, cURL proxy supoort #36

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
5 participants
Contributor

moisadoru commented Aug 16, 2012

This pull request contains:

  • a small fix for the cases when there is more than one proxy, and HTTP_X_FORWARDED_HOST contains a comma separated list of all the proxy hosts the request was passed through; example: when the application is behind domainA.com and domainB.com, HTTP_X_FORWARDED_HOST contains 'domainB.com, domainA.com'.
  • added proxy support for accessing the remote Facebook API; some corporate servers are not directly exposed to the wild, but instead they must use internal proxies to access the web.
@moisadoru moisadoru added proxy support; fixed multiple chained proxies present in HTTP_X…
…_FORWARDED_HOST which cause getHttpHost() to break api calls
716657e

@nikcorg nikcorg and 1 other commented on an outdated diff Sep 19, 2012

src/base_facebook.php
@@ -320,6 +331,47 @@ public function getFileUploadSupport() {
}
/**
+ * Sets the proxy to be used when doing http requests to the rmote servers
@nikcorg

nikcorg Sep 19, 2012

If you're interested, there's a typo on this line. At the very end it says "rmote servers" which should be "remote servers".

@moisadoru

moisadoru Sep 19, 2012

Contributor

Thanks Niklas!

@nikcorg nikcorg commented on an outdated diff Sep 19, 2012

src/base_facebook.php
@@ -320,6 +331,47 @@ public function getFileUploadSupport() {
}
/**
+ * Sets the proxy to be used when doing http requests to the rmote servers
+ *
+ * @param string $proxyUrl The procy URL string, including scheme, username,
@nikcorg

nikcorg Sep 19, 2012

Typo: "The procy" should be "The proxy"

eirikhm commented Apr 3, 2013

+1 for this. This is a must when working from more secure platforms.

manuelhe commented Apr 3, 2013

Why use a custom procedure to support curl proxy connections if you can inject multiple curl options with a simple change? Take a look at my proposal: facebook#52

Contributor

moisadoru commented Apr 16, 2013

@manuelhe There are two problems with your proposed changes:

  • since BaseFacebook::$CURL_OPTS is public and static, modifying it from inside an instance will affect all future instances; sometimes this is not desirable.
  • it does not solve the problem with multiple proxies in $_SERVER['HTTP_X_FORWARDED_HOST'] (when the request is proxied through more than one proxy server)
Contributor

gfosco commented Oct 17, 2013

Sorry it took so long to respond to this, and thank you for your contribution. This topic will now be tracked by Issue #103 for future enhancement.

@gfosco gfosco closed this Oct 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment