Koozali.org: home of the SME Server

Understanding ProxyPass (sorry same question asked two posts down).

Offline fastlane2

  • 3
  • +0/-0
I couple of years ago I used the proxypass contrib to redirect through an SME box to an internal server. I'm trying to do the same using the db directives but can't seem to get the required result.

I have a domain http://mydomain.com and I would like http://mydomain.com/extra to forward to the internal server. Can this still be done?

Many thanks.
« Last Edit: July 15, 2011, 01:33:09 PM by fastlane2 »

Offline mmccarn

  • *
  • 2,574
  • +6/-0
Re: Understanding ProxyPass (sorry same question asked two posts down).
« Reply #1 on: July 17, 2011, 03:12:01 PM »
You can do what you want by creating a custom template fragment that enables proxypass on ".../extra"; the notes from this forum discussion should help.

On my both my SME 7.5.1 and SME 8b6 systems I have a template fragment /etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ProxyPass that makes it look like you could do what you want using:
Code: [Select]
db accounts set extra ProxyPass
db accounts setprop extra Target http://192.168.1.35
db accounts setprop extra Description InternalServer
db accounts setprop extra HTTP on
db accounts setprop extra HTTPS on
db accounts setprop extra ValidFrom 80.90.100.0/24,74.125.93.105
expand-template /etc/httpd/conf/httpd.conf
sv t httpd-e-smith
(set xxxx ProxyPass, setprop xxxx Target http://<target> and setprop xxxx Description <description> are required; all other lines are optional)

* I can't find any docs in the wiki on this
* It doesn't look like these directives are going to work for HTTPS connections by default (they end up inside a "Listen 0.0.0.0:80" section in httpd.conf), but I'm no expert on httpd.conf. 
From my digging, it looks like 35ProxyPass is old (mentioned in a bug from 2006), while ProxyPass SSL support was fixed in a later bug (in 2007), by which time the ProxyPass code had been moved to the virtual domains templates.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Understanding ProxyPass (sorry same question asked two posts down).
« Reply #2 on: July 17, 2011, 08:46:36 PM »
* I can't find any docs in the wiki on this
They are in the FAQ: http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass

Code: [Select]
db accounts set extra ProxyPass
db accounts setprop extra Target http://192.168.1.35
db accounts setprop extra Description InternalServer
db accounts setprop extra HTTP on
db accounts setprop extra HTTPS on
db accounts setprop extra ValidFrom 80.90.100.0/24,74.125.93.105
expand-template /etc/httpd/conf/httpd.conf
sv t httpd-e-smith
HTTP and HTTPS are set to yes by default, so there is no need to set it. Apart from that it is preferred to use no when you want it to be disabled, over on/off or enabled/disabled.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline mmccarn

  • *
  • 2,574
  • +6/-0
Re: Understanding ProxyPass (sorry same question asked two posts down).
« Reply #3 on: July 18, 2011, 01:46:24 PM »
http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass
That wiki page only covers ProxyPass directives in the "domains" database, with no mention of the db settings in the "accounts" database that also generate ProxyPass directives in httpd.conf.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Understanding ProxyPass (sorry same question asked two posts down).
« Reply #4 on: July 18, 2011, 03:48:22 PM »
That wiki page only covers ProxyPass directives in the "domains" database, with no mention of the db settings in the "accounts" database that also generate ProxyPass directives in httpd.conf.
Oops, the documentation needs an update then.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline raem

  • *
  • 3,972
  • +4/-0
Re: Understanding ProxyPass (sorry same question asked two posts down).
« Reply #5 on: January 16, 2012, 08:38:51 PM »
cactus, mmccarn & all


Quote
Oops, the documentation needs an update then.

Based on various forum posts I have updated
http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass

Can people check the accuracy of what I have done.

There may be some corrections, layout improvements and additional information needed.
...