LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   httpd request redirection (https://www.linuxquestions.org/questions/linux-newbie-8/httpd-request-redirection-4175617835/)

srennivass 11-17-2017 02:25 PM

httpd request redirection
 
Hello my self sernnivass
i am testing proxy on centos 7, i have made configurations like this
browsing from windows . webserver configured on centos(192.*.**146) and owncloud installed on ubuntu 16 (192*.*.172) . i have configured proxy on centos to ubuntu as below
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /owncloud http://192.*.*.172/owncloud
ProxyPassReverse /owncloud http://192.*.*.172/owncloud
</VirtualHost>

i have configured hosts in my windows as
192.168.1.172 testsql.com
192.168.1.146 testcen.com
192.168.1.146 local.owncloud.com
when i hit testcen.com it's going to apache of centos but when i hit local.owncloud.com it's directly going to owncloud folder of ubuntu .both have same configuration then why request is going directly to owncloud instead of centos.
Is there any redirection happening could you please clarify me on this. plzzzz.

keefaz 11-17-2017 03:31 PM

Quote:

Originally Posted by srennivass (Post 5781861)
both have same configuration

It's not supposed to work like that.

See basic example in:
https://httpd.apache.org/docs/2.4/en/mod/mod_proxy.html

scott_R 11-18-2017 04:09 AM

It's doing what you told it to do.

You told Apache to redirect those requests to your local network's (Ubuntu) /owncloud folder. I suspect that you want to aim it at data instead.

I'd also check the owncloud security settings on the Ubuntu machine because it should have errored out instead of allowing you to see it's installation folder.

srennivass 11-18-2017 07:44 AM

I did proper configuration but i'm doubting " . " in name ??
 
Quote:

Originally Posted by scott_R (Post 5782112)
It's doing what you told it to do.

You told Apache to redirect those requests to your local network's (Ubuntu) /owncloud folder. I suspect that you want to aim it at data instead.

I'd also check the owncloud security settings on the Ubuntu machine because it should have errored out instead of allowing you to see it's installation folder.

I wrote rule to redirect request came for /owncloud to ubuntu's owncloud folder. but not / to ubuntu's owncloud folder. I tested with three names localowncloud.com points to / of proxy server and it's working fine and showing apache page of proxy server whereas with same i configured local.owncloud.com and it's going to /owncloud of ubuntu . Is this " . " making much difference im confused here . As per my configuration local.owncloud.com also shoud hit only proxy server's / folder but it's not happening.

Could you please help me with this to go further.

TB0ne 11-18-2017 08:02 AM

Quote:

Originally Posted by srennivass (Post 5782148)
I wrote rule to redirect request came for /owncloud to ubuntu's owncloud folder. but not / to ubuntu's owncloud folder. I tested with three names localowncloud.com points to / of proxy server and it's working fine and showing apache page of proxy server whereas with same i configured local.owncloud.com and it's going to /owncloud of ubuntu . Is this " . " making much difference im confused here . As per my configuration local.owncloud.com also shoud hit only proxy server's / folder but it's not happening.

Could you please help me with this to go further.

See post #2, where you were pointed to the example in the documentation; read and follow that.

srennivass 11-18-2017 08:08 AM

It's not clarifying my doubt
 
Quote:

Originally Posted by TB0ne (Post 5782150)
See post #2, where you were pointed to the example in the documentation; read and follow that.

Hello Thanks for your answers , but i'm not able to find is it redirection or my mistake , because same rule working differently to other domain name with same settings. i even tried with clearing caches and cookies of my browser.Could you help me in finding the issue.

TB0ne 11-18-2017 08:29 AM

Quote:

Originally Posted by srennivass (Post 5782152)
Hello Thanks for your answers , but i'm not able to find is it redirection or my mistake , because same rule working differently to other domain name with same settings. i even tried with clearing caches and cookies of my browser.Could you help me in finding the issue.

No, because it's pretty clear you haven't read the documentation. Did you read/think about what you posted initially??
Quote:

Originally Posted by srennivass
i have configured hosts in my windows as
192.168.1.172 testsql.com
192.168.1.146 testcen.com
192.168.1.146 local.owncloud.com

when i hit testcen.com it's going to apache of centos but when i hit local.owncloud.com it's directly going to owncloud folder of ubuntu .both have same configuration then why request is going directly to owncloud instead of centos.
Is there any redirection happening could you please clarify me on this. plzzzz.

I have bolded four things above for emphasis and for you to re-read.
  1. Where does Windows enter into this??
  2. You have TWO different domains, that are POINTED TO THE SAME ADDRESS, and you're surprised that they both go to the same place?
  3. Where did you think it was going to go? You explicitly TOLD Apache to redirect both of those domains to that one address.
  4. Read the LQ Rules about text-speak, and not using it.

srennivass 11-18-2017 09:55 AM

Windows is my pc and i have configured host names for respective ips.
 
Quote:

Originally Posted by TB0ne (Post 5782158)
No, because it's pretty clear you haven't read the documentation. Did you read/think about what you posted initially??

I have bolded four things above for emphasis and for you to re-read.
  1. Where does Windows enter into this??
  2. You have TWO different domains, that are POINTED TO THE SAME ADDRESS, and you're surprised that they both go to the same place?
  3. Where did you think it was going to go? You explicitly TOLD Apache to redirect both of those domains to that one address.
  4. Read the LQ Rules about text-speak, and not using it.

I want to clear you my configuration.
1.Windows is my pc and i have configured host names for respective IPs.In order to reach server just by hitting the domain names.
2.I have pointed two domains to the same IP address , and my worry is that both are not going to same place.i.e testcen.com going to proxy server's apache page and can be understood as working properly but local.owncloud.com is forwarding through proxy server and reaching the owncloud application i.e ubuntu's /owncloud folder.
both are pointed to same ip i.e proxy server's apache page .

3.Until unless i give local.owncloud.com/owncloud it should not go to ubuntu's /owncloud but it's going how ??? and Why ???

TB0ne 11-18-2017 10:00 AM

Quote:

Originally Posted by srennivass (Post 5782179)
I want to clear you my configuration.
1.Windows is my pc and i have configured host names for respective IPs.In order to reach server just by hitting the domain names.

...so unless you enter these things into the actual Apache SERVER, any virtual domain stuff you do won't be effective.
Quote:

2.I have pointed two domains to the same IP address , and my worry is that both are not going to same place.i.e testcen.com going to proxy server's apache page and can be understood as working properly but local.owncloud.com is forwarding through proxy server and reaching the owncloud application i.e ubuntu's /owncloud folder.
both are pointed to same ip i.e proxy server's apache page .
Then you need to straighten out your virtual host configuration, and follow the examples. What you posted here had one definition, not multiples, which is exactly what virtual domains are. Again, read/follow the documentation. You have errors in your configuration, and since you have posted one very small section of it, how do you think we'll be able to give you more guidance, other than telling you where an example is?
Quote:

3.Until unless i give local.owncloud.com/owncloud it should not go to ubuntu's /owncloud but it's going how ??? and Why ???
Because you, again, haven't defined your virtual hosts correctly, and cannot/should not have two domains pointing to the exact same address.


All times are GMT -5. The time now is 02:49 AM.