Hello! I would like help disabling SSL on a single directory (and its subdirectories) of a virtual host in Apache 2.4.18 on Ubuntu Server 16.04. I used /usr/bin/letsencrypt, which was installed from the Ubuntu repository. The URL in question is https://adventuresoftron.com/aa/resource/
Thanks, but it did not work. I’ve tried several variations of RewriteRule and RewriteCond, all of them still redirect to HTTPS or timed out. None of the apache logs seem to be of any help either. I’m really baffled by this.
I should have explained my intention (I thought this was a fairly common task). I have a game server that needs to access resources on the secure server, but the game server cannot handle encrypted connections. Ideally I would like HTTP for one directory and subdirectories and HTTPS for the rest.
Yes, all you can do is run HTTP and HTTPS simultaneously and redirect (or don’t) a request from one to the other.
The TLS in HTTPS happens before the server sees any URL path, so it can’t make decisions based on it before the connection is fully established.
In your case the right thing to do is to exclude a certain path from being redirected from HTTP to HTTPS (which is a different thing than forcing a HTTPS client back to HTTP). That’s why the exact use case is important information.
Yes, I did restart Apache and no, there are no .htaccess files or other redirects that I am aware of. I checked the Apache user list for a thread, but there are so many topics I can’t quite capture the right specificity of search terms. Anyone know of a good site for Apache support? I can here because I’m using Let’s Encrypt, but I think this is more of an Apache configuration issue, am I right? Thanks for the help so far.
You are right this is more of an apache issue, yes.
I’m a little surprised that didn’t work. I’d also suggest just commenting out that section to test that is the only code causing a redirect. Also be careful how you test - if you are testing in a browser, it will remember the previous instruction for a “permanent” redirect - and redirect anyway (even without the code, since it has cached the information).
I’m a little surprised there isn’t more support on the Internet regarding this topic, but thanks for help anyway. This thread looks like a dead end.
Using what you typed there, how would my configuration look? I’m sorry, I find Apache very hard to understand even after reading the docs multiple times.
So the basic problem with your existing configuration is that you’re actually doing the redirect twice: first with mod_alias (Redirect) and then again with mod_rewrite (RewriteRule). You should pick one to fix, and remove the other.
If you choose mod_alias, use @Shnoulle’s suggestion, which in your case would look like this:
In either case, the configurations above should replace your existing <VirtualHost *:80> section, while the <VirtualHost *:443> section should remain unchanged.
@jmorahan, that helps me understand Apache much better, thank you. Unfortunately it does not solve the problem. At this point I wish I had not used the Let’s Encrypt binary and installed certificates manually because I have no idea what the program did to make this so difficult.
It seems to me that having some non-SSL resources on a server should be a much more common considering we are still transitioning to the encrypted web and there are a lot of old services out there. Now it looks like I must go backwards to HTTP only. This is a real disappointment. I wish there was an expert who could help me.
There are plenty of experts here, and I’m sure they would be happy to help if you fully describe the problem you’re still having eg maybe if you post the exact config you tried, someone might spot the problem. You did reload apache and clear your browser cache again, right?