Mailing List Archive

(Directory /admin AND (NOT Is SSL/TLS)) redirects to domain instead of folder
Hi Everybody,

I have a site that is using HTTP, but want to force HTTPS when the url is
http://example.com/admin. This URL will be accessed by users of the site,
and I want like it to be available to them in a secure way.

I created a (Directory /admin AND (NOT Is SSL/TLS)) rule, with a redirect
handler from regexp /(.*)$ to https://${host}/$1 as described in the
cookbook (http://www.cherokee-project.com/doc/cookbook_http_to_https.html)

The rule in /etc/cherokee/cherokee.conf:
vserver!3!rule!200!disabled = 0
vserver!3!rule!200!handler = redir
vserver!3!rule!200!handler!rewrite!10!regex = /(.*)$
vserver!3!rule!200!handler!rewrite!10!show = 1
vserver!3!rule!200!handler!rewrite!10!substring = https://${host}/$1
vserver!3!rule!200!match = and
vserver!3!rule!200!match!final = 1
vserver!3!rule!200!match!left = directory
vserver!3!rule!200!match!left!directory = /admin
vserver!3!rule!200!match!right = not
vserver!3!rule!200!match!right!right = tls
vserver!3!rule!200!only_secure = 0

The problem is that this rule redirects to https://example.com instead of
https://example.com/admin. How can I make it redirect to the original url?

I also would like to create another rule later that will redirect all https
to http if the url is not .../admin.

--
View this message in context: http://cherokee-web-server-general.1049476.n5.nabble.com/Directory-admin-AND-NOT-Is-SSL-TLS-redirects-to-domain-instead-of-folder-tp5118027p5118027.html
Sent from the Cherokee Web Server - General mailing list archive at Nabble.com.
_______________________________________________
Cherokee mailing list
Cherokee@lists.octality.com
http://lists.octality.com/listinfo/cherokee
Re: (Directory /admin AND (NOT Is SSL/TLS)) redirects to domain instead of folder [ In reply to ]
Using 1.2.101-1~natty~ppa1.

--
View this message in context: http://cherokee-web-server-general.1049476.n5.nabble.com/Directory-admin-AND-NOT-Is-SSL-TLS-redirects-to-domain-instead-of-folder-tp5118027p5118085.html
Sent from the Cherokee Web Server - General mailing list archive at Nabble.com.
_______________________________________________
Cherokee mailing list
Cherokee@lists.octality.com
http://lists.octality.com/listinfo/cherokee
Re: (Directory /admin AND (NOT Is SSL/TLS)) redirects to domain instead of folder [ In reply to ]
Since the rule being applied to the 'admin' directory, you might need to
rewrite to https://${host}/admin/$1

On Wed, Jan 4, 2012 at 8:29 AM, kultsar <kultsar@gmail.com> wrote:

> Hi Everybody,
>
> I have a site that is using HTTP, but want to force HTTPS when the url is
> http://example.com/admin. This URL will be accessed by users of the site,
> and I want like it to be available to them in a secure way.
>
> I created a (Directory /admin AND (NOT Is SSL/TLS)) rule, with a redirect
> handler from regexp /(.*)$ to https://${host}/$1 as described in the
> cookbook (http://www.cherokee-project.com/doc/cookbook_http_to_https.html)
>
> The rule in /etc/cherokee/cherokee.conf:
> vserver!3!rule!200!disabled = 0
> vserver!3!rule!200!handler = redir
> vserver!3!rule!200!handler!rewrite!10!regex = /(.*)$
> vserver!3!rule!200!handler!rewrite!10!show = 1
> vserver!3!rule!200!handler!rewrite!10!substring = https://${host}/$1
> vserver!3!rule!200!match = and
> vserver!3!rule!200!match!final = 1
> vserver!3!rule!200!match!left = directory
> vserver!3!rule!200!match!left!directory = /admin
> vserver!3!rule!200!match!right = not
> vserver!3!rule!200!match!right!right = tls
> vserver!3!rule!200!only_secure = 0
>
> The problem is that this rule redirects to https://example.com instead of
> https://example.com/admin. How can I make it redirect to the original url?
>
> I also would like to create another rule later that will redirect all https
> to http if the url is not .../admin.
>
> --
> View this message in context:
> http://cherokee-web-server-general.1049476.n5.nabble.com/Directory-admin-AND-NOT-Is-SSL-TLS-redirects-to-domain-instead-of-folder-tp5118027p5118027.html
> Sent from the Cherokee Web Server - General mailing list archive at
> Nabble.com.
> _______________________________________________
> Cherokee mailing list
> Cherokee@lists.octality.com
> http://lists.octality.com/listinfo/cherokee
>
Re: (Directory /admin AND (NOT Is SSL/TLS)) redirects to domain instead of folder [ In reply to ]
Hi Daniel,

Thank you, it works. Had to fight it though, for some reason cherokee
applied the rule only after I have restarted it. /etc/initd.d/cherokee stop
said there were no processes to stop, though there were processes, the
server was working, but not applying the rules.

Now it works, anyway, thank you again.

On 5 January 2012 03:48, Daniel Lo Nigro-2 [via Cherokee Web Server -
General] <ml-node+s1049476n5121627h32@n5.nabble.com> wrote:

> Since the rule being applied to the 'admin' directory, you might need to
> rewrite to https://${host}/admin/$1
>
>


--
View this message in context: http://cherokee-web-server-general.1049476.n5.nabble.com/Directory-admin-AND-NOT-Is-SSL-TLS-redirects-to-domain-instead-of-folder-tp5118027p5122208.html
Sent from the Cherokee Web Server - General mailing list archive at Nabble.com.