Trying to redirect - too many redirects


(Mark) #1

Hi All,

I am quite a novice user but I am trying to redirect a proxy as below

cloud.website.com {
redir owncloud/index.php/login
proxy / http://10.0.0.125/ {
transparent
}
}

I get the following

This page isn’t working

cloud.websiite.com redirected you too many times.

ERR_TOO_MANY_REDIRECTS

However, If I browse to another site that is the admin page which is displayed below and add https://cloudadmin.website.com/owncloud/index.php/login it works below is the config for the cloudadmin

cloudadmin.website.com {
proxy / http://10.0.0.125/ {
transparent
}

Also If I change the proxy to the following

cloud.website {

proxy / http://10.0.0.125/owncloud {
    transparent
}

}

I get thisNot Found

The requested URL /owncloud/owncloud/index.php/login was not found on this server.


(Matthew Fay) #2

Hi @pavili0n,

You’ve configured your redir to apply to all requests for cloud.website.com. You probably don’t want to do that, because you’re redirecting to cloud.website.com/owncloud/index.php/login, which has a redir which applies to all requests, which redirects the user… You see the problem?

You need to make sure you aren’t redirecting if the request matches where you sent them. I’m guessing you just want to make sure the client is in /owncloud, so try this on for size:

redir {
  if {path} not_starts_with /owncloud
  / /owncloud/index.php/login
}

(Mark) #3

@Whitestrake Matthew as always thanks so much for your help it is really appreciated. I see my mistake and your fix has helped me out I also had to remove the /owncloud from the proxy so it is now . proxy / http://10.0.0.125/

You are a real credit to this community!


(Matthew Fay) #4

Thanks! :smiley:


(Mark) #5

@Whitestrake can you help me with one further problem where the page cloudadmin.website.com won’t render / load the information. All I can see is the background how would I be best to diagnose that?


(Matthew Fay) #6

Try to access http://10.0.0.125/ in the browser and see what comes up. Caddy’s just relaying exactly what it’s getting from up stream, so make sure that’s working fine. Clear browser caches etc. to make sure you’re getting the actual result.


(Mark) #7

Thanks again - I tested the IP on the server worked fine tested the link cloudadmin.website.com externally didn’t work tried external site on server did work guess its the cache :slight_smile:


(system) #8

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.