You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nizar KHEIR <ni...@yahoo.fr> on 2007/11/19 18:17:02 UTC

[users@httpd] https redirect without refresh

Hello every body,
  i have a question about redirecting the apache server from http to https dynamically. In fact, i proceed with the modification of the apache2.conf file, and i force reload the server each time i want to redirect from http to https or vice versa (sure after commenting/decommenting lines in apache2.conf). I have my apache server configured with php module. And i am using my server as a webmail server by adding squirrelmail. 
  Once i am connected through squirrelmail, and i want to switch from http to https or vice versa, the switching doesn't take place until i refresh the page, however, as long as i am navigating through the same "squirrelmail.php" dynamic page, my server always runs with http. So is their a way to redirect from http to https (or vice versa) without having each time to ask users to refresh their pages ??? 
   
  my apache2.conf holds the lines below:
   
  <VirtualHost *:80>
  <IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTPS} !^on $ [NC]
  RewriteRule .https://%{HTTP_HOST}%{REQUEST_URI} [L]
  </IfModule>
  Alias /squirrelmail /var/www/squirrelmail
  <Directory /var/www/squirrelmail>
    ....
  </Directory>
   
  To redirect to https, i comment the code between the IfModule brackets. 
  the 443 virtual host is unchanged (for an http -> https redirection), and i have no problem when using https or http alone (without redirection), that's mean that i have no errors of configuration at this level.
   
  Hint: i have no problem with the redirection itself because when i refresh the page, the redirection takes place, but what i need is a redirection when clicking on anything in the dynamic page, not necessarly refreshing the page, because as you know, anytime we click on a link within the dynamic php page,  new request is generated to the server, so theoretically, it must lead to a redirection, so why this redirection does not take place only if i refresh the page ????
   
  thanks for your help;
  nizar

             
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

[users@httpd] RE : Re: [users@httpd] RE : Re: [users@httpd] https redirect without refresh

Posted by Nizar KHEIR <ni...@yahoo.fr>.
Hy krist, and hy everybody,
   
  In fact i think you have not understand my question.
  The fact is that i'm working in an environment where my config should modify dynamically, so in certain conditions, i want to give users access with http (non secure), and in other circonstences, i want to redirect already http connected users to https on the fly, without loosing their connections, and this must occur transparently for the user. So imagine that i start my apache2 server without any directive for redirecting from http to https. All connections take place with http. this is realized by the line:
   
  Include /etc/apache2/squirrelmail.conf in the /etc/apache2/sites-available/default configuration file (the same directive is present in the /etc/apache2/sites-available/ssl configuration file, so users can either access by http or https).
   
  As my server is running normally with this configuration, i reach a situation where, for example, i received an alert of a man in the middle attack, thus i want to redirect all users to https. What i do is the following:
  1) i comment the line Include /etc/apache2/squirrelmail.conf only for the /etc/apache2/sites-available/default configuration file.
  2) i decomment the lines (in the same file):
      <IfModule mod_rewrite>
      <Location /squirrelmail>
       RewriteEngine on
       RewriteCond %{HTTPS} !=on
       RewriteRule .* https://%{HTTP_HOST}:443%{REQUEST_URI} [QSA,R=permanent,L]
   </Location>
</IfModule>
   
  Or the lines (what ever you want, i have always strictly the same result):
  Redirect permanent /squirrelmail https://secured.example.org/squirrelmail 
   
  Than i restart my apache2 server like: /etc/init.d/apache2 restart.
  Now the result is that as long as the already connected users does not refresh their pages with firefox, all their squirrelmail transactions remains in http, unless they proceed with a refresh for their pages. So what i need is to redirect to https after the first click in the squirrelmail dynamic page without having to explicitly refresh the page. 
  So please can someone help me ??? what i have to do ????
  Thanks
  nizar  
  
Krist van Besien <kr...@gmail.com> a écrit :
  On Nov 19, 2007 6:49 PM, Nizar KHEIR wrote:
> thanks for your reply, in fact, i tried
> redirect permanent / https://myserver/
> Always the same result, to switching until i proceed with a refresh :s,
> nizar

Have you read this:
http://www.squirrelmail.org/docs/admin/admin.html#toc8.3

Krist



             
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

Re: [users@httpd] RE : Re: [users@httpd] https redirect without refresh

Posted by Krist van Besien <kr...@gmail.com>.
On Nov 19, 2007 6:49 PM, Nizar KHEIR <ni...@yahoo.fr> wrote:
> thanks for your reply, in fact, i tried
> redirect permanent / https://myserver/
> Always the same result, to switching until i proceed with a refresh :s,
> nizar

Have you read this:
http://www.squirrelmail.org/docs/admin/admin.html#toc8.3

Krist



-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] RE : Re: [users@httpd] https redirect without refresh

Posted by Nizar KHEIR <ni...@yahoo.fr>.
thanks for your reply, in fact, i tried 
  redirect permanent / https://myserver/
  Always the same result, to switching until i proceed with a refresh :s, 
  nizar

Michael McGlothlin <mi...@swplumb.com> a écrit :
  Redirect 301 / https://myserver.com/ is usually easier than mod_rewrite?
> Hello every body,
> i have a question about redirecting the apache server from http to 
> https dynamically. In fact, i proceed with the modification of the 
> apache2.conf file, and i force reload the server each time i want to 
> redirect from http to https or vice versa (sure after 
> commenting/decommenting lines in apache2.conf). I have my apache 
> server configured with php module. And i am using my server as a 
> webmail server by adding squirrelmail.
> Once i am connected through squirrelmail, and i want to switch from 
> http to https or vice versa, the switching doesn't take place until i 
> refresh the page, however, as long as i am navigating through the same 
> "squirrelmail.php" dynamic page, my server always runs with http. So 
> is their a way to redirect from http to https (or vice versa) without 
> having each time to ask users to refresh their pages ??? 
> 
> my apache2.conf holds the lines below:
> 
> 
> 
> RewriteEngine on
> RewriteCond %{HTTPS} !^on $ [NC]
> RewriteRule .https://%{HTTP_HOST}%{REQUEST_URI} [L]
> 
> Alias /squirrelmail /var/www/squirrelmail
> 
> ....
> 
> 
> To redirect to https, i comment the code between the IfModule brackets.
> the 443 virtual host is unchanged (for an http -> https redirection), 
> and i have no problem when using https or http alone (without 
> redirection), that's mean that i have no errors of configuration at 
> this level.
> 
> Hint: i have no problem with the redirection itself because when i 
> refresh the page, the redirection takes place, but what i need is a 
> redirection when clicking on anything in the dynamic page, not 
> necessarly refreshing the page, because as you know, anytime we click 
> on a link within the dynamic php page, new request is generated to 
> the server, so theoretically, it must lead to a redirection, so why 
> this redirection does not take place only if i refresh the page ????
> 
> thanks for your help;
> nizar
-- 
Michael McGlothlin
Southwest Plumbing Supply
             
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

Re: [users@httpd] https redirect without refresh

Posted by Michael McGlothlin <mi...@swplumb.com>.
Redirect 301 / https://myserver.com/ is usually easier than mod_rewrite?
> Hello every body,
> i have a question about redirecting the apache server from http to 
> https dynamically. In fact, i proceed with the modification of the 
> apache2.conf file, and i force reload the server each time i want to 
> redirect from http to https or vice versa (sure after 
> commenting/decommenting lines in apache2.conf). I have my apache 
> server configured with php module. And i am using my server as a 
> webmail server by adding squirrelmail.
> Once i am connected through squirrelmail, and i want to switch from 
> http to https or vice versa, the switching doesn't take place until i 
> refresh the page, however, as long as i am navigating through the same 
> "squirrelmail.php" dynamic page, my server always runs with http. So 
> is their a way to redirect from http to https (or vice versa) without 
> having each time to ask users to refresh their pages ??? 
>  
> my apache2.conf holds the lines below:
>  
> <VirtualHost *:80>
> <IfModule mod_rewrite.c>
> RewriteEngine on
> RewriteCond %{HTTPS} !^on $ [NC]
> RewriteRule .https://%{HTTP_HOST}%{REQUEST_URI} [L]
> </IfModule>
> Alias /squirrelmail /var/www/squirrelmail
> <Directory /var/www/squirrelmail>
>   ....
> </Directory>
>  
> To redirect to https, i comment the code between the IfModule brackets.
> the 443 virtual host is unchanged (for an http -> https redirection), 
> and i have no problem when using https or http alone (without 
> redirection), that's mean that i have no errors of configuration at 
> this level.
>  
> Hint: i have no problem with the redirection itself because when i 
> refresh the page, the redirection takes place, but what i need is a 
> redirection when clicking on anything in the dynamic page, not 
> necessarly refreshing the page, because as you know, anytime we click 
> on a link within the dynamic php page,  new request is generated to 
> the server, so theoretically, it must lead to a redirection, so why 
> this redirection does not take place only if i refresh the page ????
>  
> thanks for your help;
> nizar
>
> ------------------------------------------------------------------------
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails 
> <http://www.trueswitch.com/yahoo-fr/> vers Yahoo! Mail 


-- 
Michael McGlothlin
Southwest Plumbing Supply


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org