View previous topic :: View next topic |
Author |
Message |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Mon Sep 11, 2006 10:17 am Post subject: http://www. => https://www. redirect ... |
|
|
Abyss and STunnel are working nice on my server with SSL ...
My Abyss installed on C:\Program Files\Abyss Web Server\
My Abyss Root server: D:\webserver\
with index.html:
<html>
<head>
<meta http-equiv="refresh" content="0;URL=https://www.mysite.bb/website/" />
</head>
</html>
Does the job: everyone who goes to mysite.bb (no matter or http://, https:// or www. will be redirected to https://www.mysite.bb/website/ in my serverdirectory D:\webserver\website\.
So far so good.
Only one problem left:
Someone who goes DIRECTLY to this directory with http://www.mysite.bb/website/ will NOT be redirected. And so doesn't use SSL.
(a small problem, but I'm a perfectionist)
Who knows what to do?
Thanks! |
|
Back to top |
|
 |
Tom Chapman -
Joined: 09 Jul 2005 Posts: 933 Location: Australia
|
Posted: Mon Sep 11, 2006 10:42 am Post subject: |
|
|
a php script would do the job or atleast should I think :o |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Mon Sep 11, 2006 11:01 am Post subject: |
|
|
Thanks for your reply!
Yes, you're right. But I don't want to use any script in my serverdirectory D:\webserver\website\
Is there an other solution with no scripts (in that directory)?
Thanks! |
|
Back to top |
|
 |
Tom Chapman -
Joined: 09 Jul 2005 Posts: 933 Location: Australia
|
Posted: Mon Sep 11, 2006 11:07 am Post subject: |
|
|
Most probably not but there maybe a few tricks you can use in the settings thongy for abyss |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Mon Sep 11, 2006 11:19 am Post subject: |
|
|
MrWiseOne wrote: | Most probably not ... |
I think there is a trick in Abyss ...But I'm no expert.
That's why I put my question here ...
8) |
|
Back to top |
|
 |
Tom Chapman -
Joined: 09 Jul 2005 Posts: 933 Location: Australia
|
Posted: Mon Sep 11, 2006 11:49 am Post subject: |
|
|
lol sorry I couldn't help more..
The professionals will be on later on from the UK.. *sarcasim ;)* |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Mon Sep 11, 2006 3:47 pm Post subject: |
|
|
A single line of PHP does the exact same thing.
Code: | <?php header("location: https://www.host.domain"); ?> |
You could also use the custom headers in Abyss to redirect the user. |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Tue Sep 12, 2006 1:22 am Post subject: |
|
|
cmxflash wrote: | A single line of PHP does the exact same thing.
Code: | <?php header("location: https://www.host.domain"); ?> |
|
Yes, I know. Thanks anyway ... Like I mentioned: I only want ONE index.html in D:\webserver\ (see above) and nothing else anywhere, anyplace, anytime in D:\webserver\website\ ...
cmxflash wrote: | You could also use the custom headers in Abyss to redirect the user. |
That's where I'm looking for, maybe. How do you do that? (sorry, I'm a newbie).
So how to prevent http://www.mysite.bb/website to be NOT automaticly redirected to https://www.mysite.bb/website with your suggestion about a customs headers fix in my Abyss?
Thanks!
(Sorry for my English: I'm Dutch)
|
|
Back to top |
|
 |
Tom Chapman -
Joined: 09 Jul 2005 Posts: 933 Location: Australia
|
Posted: Tue Sep 12, 2006 7:39 am Post subject: |
|
|
Siert wrote: | (Sorry for my English: I'm Dutch) |
I would never have known. ;) |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Wed Sep 13, 2006 10:11 am Post subject: |
|
|
Anybody who can help me?
Thanks! |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Wed Sep 13, 2006 3:54 pm Post subject: |
|
|
Siert wrote: |
cmxflash wrote: | You could also use the custom headers in Abyss to redirect the user. |
That's where I'm looking for, maybe. How do you do that? (sorry, I'm a newbie).
So how to prevent http://www.mysite.bb/website to be NOT automaticly redirected to https://www.mysite.bb/website with your suggestion about a customs headers fix in my Abyss?
Thanks!
(Sorry for my English: I'm Dutch)
|
Host configuration > General > Advanced parameters > Custom HTTP Headers.
Add the following header:
Path: /index.html or whatever page/dir should redirect to the other location
Name: Location
Value: http://host.domain/page.html |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Thu Sep 14, 2006 9:16 am Post subject: |
|
|
cmxflash wrote: | Add the following header:
Path: /index.html or whatever page/dir should redirect to the other location
Name: Location
Value: http://host.domain/page.html |
Sorry cmxflash, I'm not smart enough: what exactly does this do?
In the tutorial I read:
Custom HTTP Headers: Use this table to declare custom HTTP headers that will be included in the server responses. A custom header is added when the request's virtual path matches with the value or the pattern of its associated Virtual Path field. See the "Patterns Format" appendix for more information about patterns. The HTTP headers Server, Connection, Keep-Alive, Transfer-Encoding, and Content-Length cannot be customized.
Too difficult for me ...
Path: everybody who use mysite.bb/everydirectory/etc/etc (with or without http:// , https:// or www.) wil be redirected to root/index.html ??? (then my problem is solved!)
Name: only a name for this Custom HTTP Header ???
Value: https://www.mysite.bb/website ??? (don't know what http://host.domain/page.html means: what's this value?)
Thanks for your help! |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Tue Sep 19, 2006 8:59 am Post subject: |
|
|
Is there someone who can explain to me how "Custom HTTP Headers" works?
See above: I don't understand the tutorial on this subject ...
Thanks! |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Sep 19, 2006 9:21 am Post subject: |
|
|
Hi Siert,
When you say "mysite.bb/everydirectory/etc/etc", do you mean referencing the
URL's that don't exist on your server? If so, you can easily take a client back to
the top root of your website apon request.
Example:
mysite.bb/blah/blah/blah (Results in a 404 Error).
Just set a Custom Error to do the trick
Example:
Status Code: 404
Virtual Path: /root/index.html
Did this fix the problem? And if not, you will have to wait for "URL Rewriting"
to be available with "Abyss Web Server." It should be in the next release. :-)
Sincerely, Josh (TRUSTAbyss) |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Fri Sep 22, 2006 8:12 am Post subject: |
|
|
TRUSTAbyss wrote: | Hi Siert,
When you say "mysite.bb/everydirectory/etc/etc", do you mean referencing the
URL's that don't exist on your server? |
Hi Josh,
NO: they are existing directories on my server!
But only if someone type http://www.mysite.bb/everydirectory/etc/etc he or she will be NOT redirected to https://www.mysite.bb/website (= root/index.html). That's the problem ...
And cmxflash suggested I should use "Custom HTTP Headers" in Abyss to redirect http://www.mysite.bb/everydirectory/etc/etc to https://www.mysite.bb/website. That should do the job. But I did not understand his explination nor the tutorial on this subject ...
Thanks for your help! |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Sep 22, 2006 10:16 am Post subject: |
|
|
I don't think this is possible. You will have to use "URL Rewriting" when it
becomes available. Why would you add SSL to a website? You should only
use SSL on Important Form processing. |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Fri Sep 22, 2006 10:28 am Post subject: |
|
|
I think "Custom HTTP Headers" will do the job, just like cmxflash suggested ...
But I don't understand how this table in Abyss (with Path, Name and Value) works ... |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Sep 22, 2006 10:30 am Post subject: |
|
|
Custom HTTP Headers - Add
Virtual Path: /website
Name: Location
Value: https://www.mysite.bb/website
Now here's the problem why I think it won't work. It will work if you just link to
the /website folder with no file across it, but it won't work if you add the file at
the end of it. I don't think there's a workaround for this.
If Abyss Had "URL Rewriting", you could create a rule like.
Rewrite Rule: ^/website/?(.*)$ https://www.mysite.bb/website/$1
Sincerely, Josh (TRUSTAbyss)
Last edited by TRUSTAbyss on Fri Sep 22, 2006 10:37 am; edited 2 times in total |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Fri Sep 22, 2006 10:34 am Post subject: |
|
|
OK. Thanks!
But what's the result? What happens? |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Sep 22, 2006 10:37 am Post subject: |
|
|
I edited my post. Read again. |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Fri Sep 22, 2006 11:12 am Post subject: |
|
|
Okay: I give up, nothing works ...
So you can't redirect http:// to https:// with subdirectories on a website in Abyss. Only the root directory can be changed from http:// to https:// within a index.html file ...
I will wait till "URL Rewriting" comes available in Abyss. No problem.
Everybody thanks sofar for your suggestions! |
|
Back to top |
|
 |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Fri Sep 22, 2006 1:14 pm Post subject: |
|
|
This script will redirect you from a regular HTTP connection to a HTTPS connection the way you want it:
Code: | <?php
header("Location: https://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
?> |
Remember that you must put this script before any data is sent out to the client, or PHP wont be able to modify the headers.
This script will redirect the user to the HTTPS connection regardless if the user is allready using HTTPS or HTTP.
If you're using STunnel, you may use this script to make sure the user is allways using HTTPS:
Code: | <?php
if ($_SERVER['REMOTE_ADDR'] != "127.0.0.1") {
header("Location: https://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
die();
}
?> |
STunnel acts like a local proxy and Abyss will think it's the local machine that's making the request if the user is using HTTPS. This code wont work if you're trying it out on the local machine, however, it will work for everyone else. |
|
Back to top |
|
 |
Siert -
Joined: 11 Jun 2004 Posts: 23 Location: Hoog-Keppel, the Netherlands
|
Posted: Wed Nov 15, 2006 1:20 am Post subject: |
|
|
YES! Thanks a lot cmxflash!
(sorry for the delay, I was 1,5 month away in Italy for a job - hospital ICT-systems, brrrr)
Just the way I wanted it to work ... |
|
Back to top |
|
 |
|