Disable SSL on localhost using MAMP - ssl

Month ago I've installed MAMP (not PRO) and I set SSL for localhost following this tutorial. It works perfectly by the way:
https://torbjornzetterlund.com/how-to-get-ssl-working-on-mamp-for-os-x/
Today I removed MAMP and install it again, but I can't access localhost with http://localhost, it redirects to https:// and connection is not allowed.
The apache config is the default config.
How can I remove/disable the openSSL I set?

I tried solutions mentioned here without success
Wordpress always redirects to https after copying to localhost
But the only thing that worked was to change default MAMP ports under MAMP > Preferences

I ran into a similar issue. I set up a local host SSL environment for the one site as required to develop with the Facebook Api and instagram api.
When I went to update the site to a fresh directory with the newest version in production, it would fail because the SSL is not setup for the new directory yet. Redirecting me to https://www.localhost.
My solution was to backtrack using documentation on how to enable SSL on the site. What I found is this:
This is tested on MAMP Free version, possibly works on PRO but untested.
The instructions state:
Open /Applications/MAMP/conf/apache/httpd.conf and uncomment Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf.
So I navigated to that directory, opened the httpd-ssl.conf file in my text editor and located the uncommented line, commented this line using "#" and save. Doing this resulted in disabling the ssl behavior and retains all my previous configuration.
When your ready to go back to SSL, uncomment that line and make sure you have reconfigured your ssl to the new directory(Github below explains how to configure for ssl). Here is the github I reference for the work. Good luck!
https://gist.github.com/jfloff/5138826
Line #3

I am using MAMP Free version and accidentally launched the PRO version.
It changed ports for the Free version too... So suddenly localhost and other virtual hosts changed to SSL.
Reseting ports in the Free Version with the button "Set Web & MySQL ports to 80 & 3306" worked for me.

Related

SSL installed on domain with wamp, but browser says "insecure"

I followed this tutorial Installation SSL in wamp server: Error in httpd-ssl.conf to set up SSL on my server, but still the browser says "Site is insecure".
Windows server 2012R2
Wamp server 3.1.3 64 bit.
Running Moodle on it.
Checked my domain on https://www.ssllabs.com/ssltest/ but got no errors.
Any help would be appreciated.
I solved it by adding https to the moodle configuration file. Apache related configuration was fine according to the link provided above.
Cheers

How to stop Chrome from redirecting to HTTPS?

A few days ago, Chrome started redirecting all of my vHosts in Wampserver to https. Everything was working fine until a couple days ago, then one day I logged on to work on my site and Chrome said that the site couldn't be reached, even though I used the same URL i always did in the past. Wamp is running as well as Apache and MySQL and none of those services have any errors in the error log.
I have already tried removing the domain(I use a fake .dev extension for my local sites) with chrome://net-internals/#hsts but that didn't do anything. I also tried installing SSL to see if Chrome would detect it as a secure connection... nothing. I even tried reinstalling Wamp completely(even though the vHosts work fine in other browsers) and nothing changed.
The only thing that works in Chrome is accessing the sites via http://localhost/site. The redirect to HTTPS happens for all of my Apache vHosts. I've googled and googled and can't find anything that actually fixes the problem.
Chrome v63 forces .dev domains to HTTPS. The Internet Engineering Task Force RFC2606 specified what top level domains should be used for local development, and .dev isn't on that list.
Google owns the .dev top level domain and automatically redirects all .dev domain names to an HTTPs version of the site via preloaded HSTS.
With .dev being an official generic top-level domain (gTLD), we're better changing our local development suffix from .dev to something else, even if there are other solutions (e.g. https with self-signed certificates). So you should use .test, .example, .invalid or .localhost as your local development TLDs instead.
I can't improve the answer of #benedikt, as it is correct. There are good temporary fixes:
typing "badidea" on the warning page, this might not work if you have SSL set up (hacked together) locally. It bypasses the warning, but my local SSL isn't setup correctly and shows another local site.
narayon also suggests a link to a chrome forum, which I haven't tried.
My workaround was to update all my ".dev" development TLDs to ".d3v"
Still short enough to type quickly, descriptive, and probably future-proof.
I have found a quick work-around that worked for my needs and may help someone else.
I use Browser Sync when developing and I just set the proxy argument to "testsite.dev" and it will serve up correctly in Chrome.
Here is the command I am using:
browser-sync start --proxy "testsite.dev" --port "3000" --files "./**/*.*"
I too use the .dev extension and will change to some other domain in the future but for my existing .dev sites, when the privacy error shows up, click anywhere on the screen and type 'badidea' and chrome will redirect you to the site. It works!
Solution 1 - choose a reserved and future-proof gLTD like .localhost or .test
Edit your hosts file (for Windows it is C:\Windows\System32\Drivers\etc\hosts)
127.0.0.1 testsite.localhost
Solution 2 - install a self-signed certificate for .dev
Create the certificate. Open Powershell as Admnistrator and run:
P.S. Make sure to install mkcert first
C:\Users\John> mkcert *.testsite.dev
This will create a wildcard certificate that will work for all .testsite.dev sites
Copy these keys from C:\Users\John to C:\xampp\apache\crt\testsite_dev (create the crt folder if it doesn't exist)
Add entries in your C:\Windows\System32\Drivers\etc\hosts file
127.0.0.1 testsite.dev
127.0.0.1 www.testsite.dev
Open your C:\xampp\apache\conf\extra\httpd-vhosts.conf and add an entry
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName testsite.dev
ServerAlias www.testsite.dev
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
SSLEngine on
SSLCertificateFile "crt/testsite_dev/_wildcard.testsite.dev.pem"
SSLCertificateKeyFile "crt/testsite_dev/_wildcard.testsite.dev-key.pem"
</VirtualHost>
Restart Apache
(Extra) step - make your OS & browser trust self-signed certificates, otherwise it won't work

How do you remove SSL encryption after letsencrypt set up forced SSL?

I chose to force https on my server when setting up let's encrypt, not realizing what a NIGHTMARE it would cause for my Node.js WebSocket server. Nothing that I've found online works to get a secure WebSocket connection up and running. (Probably because I'm using Apache for everything aside from WebSockets)
So I've decided to just disable SSL site-wide. I don't have any real use for it as my server is strictly for development anyway.
I've tried the method here But Apache reports that the site is already disabled. So I cleared the cache on my browser and even tried to visit the site incognito to no avail.
I also looked at the instructions here but NONE of my site-available contain the lines that are mentioned.
Then I saw this post but my apache2.conf file did not contain the lines he mentioned either.
I'm puling my hair out.
If anyone else has this issue, here's what I did to solve it.
I saw a configuration file named <sitenam>-le-ssl.conf in /etc/apache2/sites-enabled So I tried a2dissite <sitename>-le-ssl.conf
But Apache said "the file doesn't exist"
So I copied that file to my home directory with cp <sitename>-le-ssl.conf ~(AND YOU SHOULD TOO! just in case...)
Then I deleted that file with sudo rm <sitename>-le-ssl.conf
Then, restart apache with sudo service apache2 restart
Finally, clear the cache on your browser and visit your site. Everything should be back to normal now.
No idea why letsencrypt set up my server in such an odd way. It didn't follow ANY of the standards that others said it should.
Hope this helps someone in the future.

WAMP localhost redirects to my IP

I had to recently wipe my PC and I'm setting up my development environment again using WAMP.
After installing WAMP, if I visit http://localhost instead of seeing the WAMP homepage I get redirected to http://x.x.x.x, where x.x.x.x is my IP.
I had this issue on another PC and after setting the inbound rules for Apache HTTP Server in my Windows Firewall settings to allow all domains it fixed the issue. I applied this to my PC, and the issue does not seem to be present for Internet Explorer, whereas for Chrome and Firefox the localhost to my IP redirect issue persists even after clearing the cache for each browser.
My C:\Windows\System32\drivers\etc\hosts file looks like this:
127.0.0.1 localhost
::1 localhost
and my firewall rules look like this:
I am not currently using vhosts and I'm on a network at my workplace (if that has any implications?)
I also encountered the same issue when using Laragon which uses vhosts and whenever I visited a virtual host, e.g. mysite.dev it didn't work properly either.
My question on the Laragon forum: https://forum.laragon.org/topic/126/accessing-mysite-dev-redirects-to-url-which-shows-index-php-at-root-folder/3
The Problem
I'm behind a proxy which is used for browsing the web at my workplace. The proxy seemed to be messing up the dns resolution whenever I made a call to localhost (when using wamp) or one of my vhosts (when using Laragon).
This was clear as when I ran the following from the command line: ping site.dev I was getting the expected response from 127.0.0.1. However, when going to site.dev in my browser I was getting redirected to my IP, so essentially my etc/hosts file was being ignored for dns resolution.
The difference between the two being that the browser is using the proxy whereas the command line isn't!
The Solution
After trying many different solutions which seemed to work for localhost (on wamp) only, but not vhosts (on Laragon) I finally got to the solution which was actually so simple!
So, for chrome I simply went to chrome://settings/ > Network - Change proxy settings > LAN Settings > Proxy Server - Advanced
Then in the Exceptions text box I added the following:
*.dev;localhost;127.0.0.1
Here's a screenshot of my settings from Chrome/Internet Options
And that did the trick! Hope this can help someone else.

Unable To Connect To MAMP Server From Other Devices

I have MAMP PRO running locally on my machine (Mavericks). I can connect find to localhost and apache is running on port 80.
The test website I have set up is served. I can browse to it via http:// my-local-host (have to put a dash in because stack exchange doesn't like URLs) or http://mymachinename.local or http://XXX.XXX.X.XX (my ipaddress).
It's not working remotely though from either iPhone or iPad. I have tried turning off the firewall. I have tried adding a rule to the firewall to allow incoming connections to httpd. Neither work.
I also have Little Snitch installed. I tried turning off Little snitch and also creating a rule to allow traffic through to port 80 via httpd. Neither work.
Anyone else had similar issues and found a resolution?
The problem is DNS.
MAMP writes your Hosts to /etc/hosts.
Example:
127.0.0.1 example.com
Your Iphone's host file has no such entry. This is why it does not work.
You need e.g. a "DNS-server", which you can enter in
Settings - Wlan - static as Router on your phone.
I think your problem would be addressed if you use the Dynamic DNS option in MAMP PRO. Then, using a third party company like noIP.com, you could setup myTestBox.ddns.net and pull up your website on your iPad.