Forum OpenACS Q&A: use of relative URL in HREF

Collapse
Posted by robert parker on
I have been developing a site using relative URLs e.g.
<A HREF="page1" >
rather than specifying the hostname and protocol.

I now come to start using https for _some_ of my pages. In order to enter these secure pages I have used the full URL that includes the hostname and the protocol in the HREF.

The problem is that the user cannot leave the "secure zone" because the remainder of the HREFs are still relative so that even though the page is not needed to be secure, the https protocol is used.

Does this mean I need to convert all my HREFs into non-relative URLs? if so what is the appropriate OACS proc to use so that I can move the site to a new hostname without recoding the pages e.g. should I use some form of ad_conn for all my HREFs like this:
<A HREF="http:<%=[ad_conn something]%>/page1">
or is there a better way?

Collapse
Posted by Torben Brosten on
There are some private procs in ecommerce that can help with that:

ec_securelink and ec_insecurelink help with presenting pages from https to http and visa versa.

Some of the other ssl related procs might be useful, too:

https://openacs.org/api-doc/procs-file-view?path=packages/ecommerce/tcl/ecommerce-ssl-procs.tcl&public%5fp=0

AFAIK, the other procs are written to work within ecommerce package, so you will probably need to recode some parts of them to work with your site.

Collapse
Posted by robert parker on
Thanks, that was very helpful.

(I dont think I'd be able to use openacs without the help I get from this forum)