Would it be possible to make stage_file_proxy work with remote server, which is protected with httpauth user/pass?

Comments

iaminawe’s picture

Was just about to request that same thing . +1 please

derEremit’s picture

Created small patch against current head
which currently is the same as 1.0 so it can be applied on top of that.

Please review...

slashrsm’s picture

Status: Active » Reviewed & tested by the community

Looks nice. Thank you for this patch.

Looking forward to have this commited.

aschiwi’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

This works without a patch:

$conf['stage_file_proxy_origin'] = 'http://user:password@example.com'; // no trailing slash

See also http://www.undpaul.de/blog/2011/12/21/stage-file-proxy-no-more-big-file-...

Please reopen this issue if that doesn't help you.

derEremit’s picture

Status: Closed (works as designed) » Needs review

could someone help verify that #4 actually does not work.
I tested on my ubuntu 12.04 setup multiple times and it does NOT work without my patch.

greggles’s picture

My sense is that #4 should work on most servers. When you say you tested it on "12.04" do you mean Apache was doing Basic Auth or that 12.04 was the "client" making requests to some other server?

derEremit’s picture

well, our devs all work on ubuntu 12.04 either directly or the mac guys with a 12.04 vm
server has basic authentication

for my patch i first added a watchdog entry to see if auth works, and with method in #4 it gives me return code 401.

tested multiple times on different machines, but everytime ubuntu 12.04 as clients.

greggles’s picture

That's convincing enough for me :) Thanks for the details derEremit.

jamsilver’s picture

#4 worked just fine for me on Ubuntu 11.04 and Ubuntu 12.10.

No need for a patch as far as I can see =)

greggles’s picture

Title: Usage with http auth » Document how to use stage file proxy with http Basic auth
Component: Code » Documentation
Status: Needs review » Needs work

We could document it.

jamsilver’s picture

It's worth saying that special characters need urlencoding with this syntax, so if your username/password is:

username: myusername
password: letme&in

then your uri would be:

$conf['stage_file_proxy_origin'] = 'http://myusername:letme%26in@example.com';

greggles’s picture

Status: Needs work » Needs review
StatusFileSize
new616 bytes

Nice, great tip!

jamsilver’s picture

Status: Needs review » Needs work
+++ b/INSTALL.txtundefined
@@ -7,7 +7,13 @@ REQUIRED:
+The origin website. If the site is using HTTP Basic Authentication the (browser

small bracket-positioning typo here I think, probably was intended to be:

+++ b/INSTALL.txtundefined
@@ -7,7 +7,13 @@ REQUIRED:
+The origin website. If the site is using HTTP Basic Authentication (the browser
greggles’s picture

Status: Needs work » Fixed
StatusFileSize
new707 bytes

Cool cool cool. I fixed that and changed the spacing around a little. The attached patch is committed.

http://drupalcode.org/project/stage_file_proxy.git/commit/e913b19

Thanks, jamsilver!

jamsilver’s picture

Awesome =)!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.