bar top left
bar top right
left curve
right curve
Welcome, Guest

Selectively allow http access to some folders
(1 viewing) (1) Guest
Go to bottom
Post Reply
Post New Topic
Page: 1
TOPIC: Selectively allow http access to some folders
#19528
Selectively allow http access to some folders 2 Years, 10 Months ago Karma: 2
HTTPS isn't too friendly with some hardware and software. Here's a trick to selectively allow a folder, or folders, to be accessed via http and not redirected to https.

  • edit /etc/httpd/conf/httpd.conf and look for the following:

  • Code:


    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


  • Change it to the following to allow http access to both the 'aastra' and 'http' folders in '/var/www/html/'.

  • Code:


    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !(/http/*)
    RewriteCond %{REQUEST_URI} !(/aastra/*)
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


  • Of course, you can copy this example to add several folders to be https exempt, or you could change 'RewriteEngine On' to 'RewriteEngine Off' and disable the redirection all together. However if you create the 'http' directory in '/var/www/html/' anything you drop in it will no longer be redirected to https


  • -THX2000
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    thx2000
    Fresh Boarder
    Posts: 14
    graphgraph
    User Offline Click here to see the profile of this user
    Reply Quote
     
    #57945
    Re:Selectively allow http access to some folders 1 Year, 5 Months ago Karma: 0
    want to add
    in some elastix versions it is useful to look for /etc/httpd/conf.d/elastix.conf file
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    trigremm
    <<...>>
    Fresh Boarder
    Posts: 6
    graphgraph
    User Offline Click here to see the profile of this user
    Gender: Male Location: Kazakhstan Birthday: 01/21
    Excuse my English
    Reply Quote
     
    #58953
    Re:Selectively allow http access to some folders 1 Year, 5 Months ago Karma: 3
    Yes, a better way to do this is adding lines for each directory to /etc/httpd/conf.d/elastix.conf like this:


    <Directory "/var/www/html/xmlservices">
    RewriteEngine Off
    </Directory>

    and then reload apache:

    service httpd restart
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    gl1176
    Junior Boarder
    Posts: 55
    graphgraph
    User Offline Click here to see the profile of this user
    Last Edit: 2010/08/31 21:32 By gl1176.
    Reply Quote
     
    #66738
    Re:Selectively allow http access to some folders 1 Year, 1 Month ago Karma: 2
    Hi

    How can we have access in a folder for example /var/www/html/a_program

    in another port and mabe another ip address?

    I have created a virtual ip under my real ip and a virtual host at the same port 443.
    But the problem is that it works partial.

    When i try to login with the virtual address i have the message for ssl in firefox, i install the ssl and then it redirect me to the real internal ip.
    When i try it from outside (internet) it is worst, i get redirected to the real internal ip and i can't see anything.

    The point is to make a program works on his own port. So i will open that port on my firewall and have access only in this programm and not everything on elastix.

    Thanks
    John
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    johnme
    Senior Boarder
    Posts: 145
    graphgraph
    User Offline Click here to see the profile of this user
    Reply Quote
     
    #67009
    Re:Selectively allow http access to some folders 1 Year, 1 Month ago Karma: 0
    Rewrite Engine on
    rewriteCond %{REQUEST_URI} !^/central/
    rewriteRule ^/([^/]+/)*([^.]+\.css)$ /central/css/$2 [L]
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    takingyouforward
    BPO Services
    Fresh Boarder
    Posts: 2
    graphgraph
    User Offline Click here to see the profile of this user
    Gender: Female takingyouforwardinc. Inbound Call Center Location: Philippines
    Links hidden for unregistered users. Login or register Here | Links hidden for unregistered users. Login or register Here | Links hidden for unregistered users. Login or register Here
    Reply Quote
     
    #67066
    Re:Selectively allow http access to some folders 1 Year, 1 Month ago Karma: 2
    Hi takingyouforward

    Can you please put some comments on your post?

    Where should we put the code you wrote in elastix?

    Is this for elastix or general for linux? (I mean have test it in elastix? and in witch version)

    Thanks
    John
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    johnme
    Senior Boarder
    Posts: 145
    graphgraph
    User Offline Click here to see the profile of this user
    Reply Quote
     
    #94377
    Re:Selectively allow http access to some folders 3 Weeks, 1 Day ago Karma: 0
    Hello all,
    I installed version 2.2 and I tried to access it via the browser but not worked.
    On this path /etc/httpd/conf.d/elastix.conf I make it like follow:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !(/http/*)
    RewriteCond %{REQUEST_URI} !(/aastra/*)
    RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}

    but not worked can you help me to fix it please

    thanks
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    salytwo
    Fresh Boarder
    Posts: 32
    graphgraph
    User Offline Click here to see the profile of this user
    Reply Quote
     
    #94378
    Re:Selectively allow http access to some folders 3 Weeks, 1 Day ago Karma: 0
    salytwo wrote:
    Hello all,
    I installed version 2.2 and I tried to access it via the browser but not worked.
    On this path /etc/httpd/conf.d/elastix.conf I make it like follow:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !(/http/*)
    RewriteCond %{REQUEST_URI} !(/aastra/*)
    RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}

    but not worked can you help me to fix it please

    thanks


    Then I change it to


    <Directory "/var/www/html">
    # Redirect administration interface to https
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !(/admin/modules/superfecta/*)
    RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}
    </Directory>

    Also not worked
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    salytwo
    Fresh Boarder
    Posts: 32
    graphgraph
    User Offline Click here to see the profile of this user
    Reply Quote
     
    #94559
    Re:Selectively allow http access to some folders 2 Weeks, 6 Days ago Karma: 0
    salytwo wrote:
    [quote]salytwo wrote:
    Hello all,
    I installed version 2.2 and I tried to access it via the browser but not worked.
    On this path /etc/httpd/conf.d/elastix.conf I make it like follow:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !(/http/*)
    RewriteCond %{REQUEST_URI} !(/aastra/*)
    RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}

    but not worked can you help me to fix it please

    thanks


    the thing is that after changhing elastix.conf and restarting apache u still will not have access to http folder but u will have access to aastra

    i dont remember correctly - but try also http s: // yourdomain / aastra /*

    ps be sure that folders aastra and content exist and readible
    Enter code here   
    Please note: although no board code and smiley buttons are shown, they are still usable.
    trigremm
    <<...>>
    Fresh Boarder
    Posts: 6
    graphgraph
    User Offline Click here to see the profile of this user
    Gender: Male Location: Kazakhstan Birthday: 01/21
    Last Edit: 2012/01/20 06:59 By trigremm.Reason: chanched url and added ps
    Excuse my English
    Reply Quote
     
    Go to top
    Post Reply
    Post New Topic
    Page: 1
    Moderators: Bob, jgutierrez