logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache through proxy (error 407)
Author
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Thu 12 Jul '12 10:37    Post subject: Apache through proxy (error 407) Reply with quote

I have proxy access on machine, so i can connect to internet only with pass and log. Also i have apache 2.2 when he try connect, he return error code 407. Where can i put ip adress, pass and log authorization proxy on apache?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 12 Jul '12 16:08    Post subject: Reply with quote

How does the apache server connect to the internet over the proxy? An application? The server itself?
Back to top
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Fri 13 Jul '12 1:46    Post subject: Reply with quote

Proxy(not apache) server located on another machine. I haven't access on it. There is another machine with apache. It's local server. It connect to the inet for update one programm. On this machine i can connect to the inet with log and pass. So, how make apache connect to the inet through or with log and pass.
P.S. OS WinXP
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 13 Jul '12 11:03    Post subject: Reply with quote

petro2033 wrote:
It connect to the inet for update one programm.
Apache itself does not do that. So is it a script? A program? What is it on that apache?
Back to top
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Fri 13 Jul '12 11:44    Post subject: Reply with quote

I download and install Win32 Binary including OpenSSL 0.9.8t (MSI Installer): httpd-2.2.22-win32-x86-openssl-0.9.8t.msi - apache server. Edit httpd.conf,httpd-vhosts.conf. So, create local server on 127.0.0.1. Then i download 2GIS_update. It adds folders update and creates one file Apache\conf\2gis_update.conf, adds line in httpd.conf which adds 2gis_update.conf. When i start the server it should download update.

2gis_update.conf:

LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule ssl_module modules/mod_ssl.so

RewriteEngine On
RewriteCond %{REQUEST_METHOD} !=POST
RewriteRule ^/ver3/stat$ MethodNotAllowed [R=405,L]

<Location /ver3/stat>
LimitRequestBody 2147483647
ProxyPass balancer://http_backend_2gis/ver3/stat
</Location>


<Directory "2gis-update.htdocs">
ForceType text/plain
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /ver3/ping 2gis-update.htdocs/ping

##ProxyServer##

<Proxy balancer://http_backend_2gis>
BalancerMember http://s1.update.2gis.ru:80
... etc
BalancerMember http://s10.update.2gis.ru:80
</Proxy>

SSLProxyEngine On
<Proxy balancer://https_backend_2gis>
BalancerMember https://s1.update.2gis.ru:443
... etc
BalancerMember https://s10.update.2gis.ru:443
</Proxy>

RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$
RewriteRule ^/ver3/download MethodNotAllowed [R=405,L]

<Location /ver3>
DefaultType application/octet-stream
ProxyPass balancer://https_backend_2gis/ver3
</Location>


CacheEnable mem /ver3/infolist
CacheEnable mem /ver3/ping
CacheEnable disk /ver3/download
CacheEnable mem /ver3//infolist
CacheEnable mem /ver3//ping
CacheEnable disk /ver3//download

##CacheRoot##
CacheDirLevels 2
CacheDirLength 2
CacheDefaultExpire 1728000
CacheMaxFileSize 268435456



access.log:

10.200.5.206 - - [12/Jul/2012:10:26:35 +1100] "GET /2gis/updsrv/serverinfo HTTP/1.1" 404 325
10.200.5.206 - - [12/Jul/2012:10:26:35 +1100] "GET /2gis/updsrv/ping HTTP/1.1" 301 348
10.200.5.206 - - [12/Jul/2012:10:26:36 +1100] "GET /2gis/updsrv/ping HTTP/1.1" 301 348
10.200.5.206 - - [12/Jul/2012:10:26:36 +1100] "GET /2gis/updsrv/serverinfo HTTP/1.1" 404 325
10.200.5.206 - - [12/Jul/2012:10:26:36 +1100] "GET /2gis/updsrv/serverinfo HTTP/1.1" 404 325
10.200.5.206 - - [12/Jul/2012:10:26:36 +1100] "GET /2gis/updsrv/ping HTTP/1.1" 301 348
127.0.0.1 - - [12/Jul/2012:10:27:35 +1100] "GET / HTTP/1.1" 200 1187
127.0.0.1 - - [12/Jul/2012:10:27:35 +1100] "GET /icons/folder.gif HTTP/1.1" 200 225
127.0.0.1 - - [12/Jul/2012:10:27:35 +1100] "GET /icons/blank.gif HTTP/1.1" 200 148
127.0.0.1 - - [12/Jul/2012:10:27:43 +1100] "GET /2gis/ HTTP/1.1" 200 949
127.0.0.1 - - [12/Jul/2012:10:27:43 +1100] "GET /icons/back.gif HTTP/1.1" 200 216
127.0.0.1 - - [12/Jul/2012:10:27:44 +1100] "GET / HTTP/1.1" 200 1187


error.log:

[Thu Jul 12 10:26:33 2012] [error] (70008)Partial results are valid but processing is incomplete: proxy: HTTPS: attempt to connect to s2.update.2gis.ru:443 via http CONNECT through 192.168.132.118:3128 (s2.update.2gis.ru) failed
[Thu Jul 12 10:26:33 2012] [error] ap_proxy_connect_backend disabling worker for (s2.update.2gis.ru)
[Thu Jul 12 10:26:33 2012] [error] send_http_connect: the forward proxy returned code is '407'
[Thu Jul 12 10:26:33 2012] [error] (70008)Partial results are valid but processing is incomplete: proxy: HTTPS: attempt to connect to s1.update.2gis.ru:443 via http CONNECT through 192.168.132.118:3128 (s1.update.2gis.ru) failed
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sat 14 Jul '12 11:57    Post subject: Reply with quote

Do I see this correctly

internet<--->non_apache_proxy<--->apache<--->backend_server

and the backend server wants to connect to the internet?
Back to top
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Sat 14 Jul '12 12:41    Post subject: Reply with quote

no! Sad
Internet<--->ProxyServ(protected,non_apache)<--->ApacheServerLocalServer(log pass for inet)<--->users(2GIS_client)

Users has not access to the inet. so they programm 2GIS(client) for update connect to apache server(local server, apache). Local server(with apache) for update 2gis connect to the inet through proxy serv(non apache) and should do it with log and pass.

When i install apache server i install 2gis server, is just .conf file for apache.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sat 14 Jul '12 16:00    Post subject: Reply with quote

I don't have a full solution yet, but you should look at
proxy-chain-auth in http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html but then the client (2GIS_client) has to send user (log) and password (pass). Apache can't do it itself as far as I know.

and maybe also

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyvia and http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyremote
Back to top
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Mon 16 Jul '12 1:04    Post subject: Reply with quote

IMHO it's not exactly what i need. There's one idea, send a request to open the access for local server on defined page(link update 2gis and port, that apache has open access on it)
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 16 Jul '12 18:23    Post subject: Reply with quote

Apache won't send user and password. That has to be done by the client, but apache can forward that to the proxy which is in front of it.
Back to top
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Tue 17 Jul '12 10:59    Post subject: Reply with quote

I don't understand what you mean. Users do not matter. They must download update from apache and mustn't know or receive log and pass. It's system of bank and i can't change something.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 17 Jul '12 14:17    Post subject: Reply with quote

Apache can not connect itself with log and pass.

If I were you, I would write a php script that runs on the apache webserver, connects through the proxy and downloads the file and delivers it to the client.
Back to top
petro2033



Joined: 12 Jul 2012
Posts: 7
Location: Russia

PostPosted: Tue 17 Jul '12 15:13    Post subject: Reply with quote

hmmm, okay thanks! I should set only downloading update from inet, because local update is working. You give me new way Smile
Back to top


Reply to topic   Topic: Apache through proxy (error 407) View previous topic :: View next topic
Post new topic   Forum Index -> Apache