LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-02-2009, 10:15 AM   #1
Zilvermeeuw
Member
 
Registered: Jan 2006
Distribution: Fedora 20, 21, 22, CentOS 6, CentOs 7
Posts: 92

Rep: Reputation: 17
subdir to other server problem


Hi All!

Again a proxy problem. I search the internet for several days with some progress. But still I have some errors.

I have two servers: server1 and server2.

Server1 is reachable from the internet on port 80. Server2 is not. I want to access server2 as it is a subfolder of server1. Meaning: http://server1/server2 should give me server2.

I made a proxy on server1:
Code:
<Location /server2>
        ProxyPass http://server2
        ProxyPassReverse http://server2
</Location>
If I use http://server1/server2, I see the index.html of server2, which is great!

On server2 I have an index.html with:
Code:
<a href="index2.html">index2</a>
If I type: http://server1/server2/, the above link refers to http://server1/server2/index2.html. Which is expected.

Strange behaviour 1:
If I type http://server1/server2 (without the trailing slash), the link refers to http://server1/index2.html, which is wrong.

Strange behaviour 2:
If a slash is added to the link on server 2:
Code:
<a href="/index2.html">index2</a>
The link refers always to: http://server1/index2.html, which is wrong.

I played with the Rewrite module, but I have too few knowledge to get it working.

What am I doing wrong?
 
Old 03-02-2009, 10:56 AM   #2
chitambira
Member
 
Registered: Oct 2008
Location: Online
Distribution: RHEL, Centos
Posts: 373
Blog Entries: 1

Rep: Reputation: 51
try just using:

Quote:
ProxyPass /server2/ http://server2
ProxyPassReverse /server2/ http://server2
 
Old 03-02-2009, 11:07 AM   #3
carlmarshall
Member
 
Registered: Jan 2004
Location: North Yorkshire, UK
Distribution: Centos 5
Posts: 133

Rep: Reputation: 16
The old trailing slash problem! Without the trailing slash your server is being asked to retrieve a file or directory called "server2" on the host "server1". You need to do a rewrite rule along the lines of:

RewriteEngine on
RewriteBase /server2/
RewriteRule ^server2$ server2/

See if that helps.

Carl.
 
Old 03-02-2009, 12:20 PM   #4
Zilvermeeuw
Member
 
Registered: Jan 2006
Distribution: Fedora 20, 21, 22, CentOS 6, CentOs 7
Posts: 92

Original Poster
Rep: Reputation: 17
Thanks! I am a little bit further now.

I understand "Strange behaviour 1" and it is solved.

"Strange behaviour 2" is still there:
On server 2, if there is a slash before the index.html, as in:
Code:
<a href="/index2.html">index2</a>
The link refers always to: http://server1/index2.html, which is wrong.
Without the slash it refers to: http://server1/server2/index2.html, which is correct.

I think another rewrite rule is needed. But it should run after the proxy.

How can I solve this?
 
Old 03-03-2009, 11:10 AM   #5
carlmarshall
Member
 
Registered: Jan 2004
Location: North Yorkshire, UK
Distribution: Centos 5
Posts: 133

Rep: Reputation: 16
Not sure how to fix this one. I guess it's happening because the proxy still refers to the chroot directory of server1 when presented with the / character.

Carl.
 
Old 03-03-2009, 11:22 AM   #6
Zilvermeeuw
Member
 
Registered: Jan 2006
Distribution: Fedora 20, 21, 22, CentOS 6, CentOs 7
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by carlmarshall View Post
Not sure how to fix this one. I guess it's happening because the proxy still refers to the chroot directory of server1 when presented with the / character.

Carl.
Yeah, I also think so. I think I need a ReWrite of the data from server2 to server1. A ReWriteReverse or so. But I have no idea how to do this one.
 
Old 03-05-2009, 01:05 PM   #7
Zilvermeeuw
Member
 
Registered: Jan 2006
Distribution: Fedora 20, 21, 22, CentOS 6, CentOs 7
Posts: 92

Original Poster
Rep: Reputation: 17
Solved with a virtualhost with a proxy.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
allowing users to have homepages in www subdir KingPanda Debian 5 10-15-2008 11:48 AM
Kernel in subdir of /boot hepburnenthorpe Debian 16 01-07-2008 03:57 PM
RAR - how do I exclude a subdir? z0diac Linux - Software 4 09-24-2007 11:43 AM
how many files on a subdir ? graziano1968 Linux - General 2 08-09-2006 11:18 PM
deleting all *.m3u files in a directory+subdir? minm Linux - Newbie 5 10-12-2004 03:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration