Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4478 closed enhancement (fixed)

Allow setups behind proxy, by allowing filtering of bp_get_requested_url

Reported by: calin's profile calin Owned by:
Milestone: 1.7 Priority: normal
Severity: normal Version: 1.6
Component: Core Keywords: has-patch
Cc:

Description

Currently there are some issues with running buddypress behind proxy, because the requested url is not filtered so it cannot be modified and replaced with the actual real URL.

If your site is running in the following configuration, www.site.com -> backend.site.com, with www.site.com being the one facing the internet, the requested_url will be constructed with backend.site.com which will invalidate the nonces and cause redirects (with possible redirect loops) to invalid canonical urls.

Attachments (1)

bp_requested_url_patch.diff (1.2 KB) - added by calin 12 years ago.
the patch against bp 1.6.1

Download all attachments as: .zip

Change History (5)

@calin
12 years ago

the patch against bp 1.6.1

#1 @boonebgorges
12 years ago

  • Milestone changed from Awaiting Review to 1.7

Great suggestion. This is a minimal fix for BP 1.7.

Is there anything BP can do to piggyback on WP for proxy setups? I haven't worked with this before. It looks like WP does have support in class-http.php for sending HTTP requests through a proxy, but I don't see anything in canonical.php that takes account of proxy setups while calculating redirect URLs. How do you handle this, calin?

#2 @calin
12 years ago

  • Keywords has-patch added

Hi, this patch is useful for running buddypress behind a reverse proxy, eg. have nginx frontend and apache as backend and not for making HTTP requests using a proxy.

For example you can have a setup where buddypress runs on apache with localhost as hostname and then you have a filter on wordpress's site_url which turns all your http://localhost/members/foo/ to http://example.com/members/foo/ and you proxy that through nginx, on hostname example.com.

So user enters in his browser http://example.com/members/foo/, but the request hits the apache backend with http://localhost/members/foo/ which will issue a redirect to http://example.com/members/foo/ and you end up with a loop.

This patch allows you to rewrite the actual requested URL in such cases.

#3 @djpaul
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6355]) Add filter to bp_get_requested_url(). Fixes #4478, props calin

#4 @DJPaul
12 years ago

Thanks for the patch. If there's anything you find we can improve in BuddyPress to enable this sort of set up, please let us know. Also, it might be useful for others if you consider writing a blog post or perhaps a page on codex.BuddyPress.org about this technique. :)

Note: See TracTickets for help on using tickets.