Skip to content

Instantly share code, notes, and snippets.

@jll90
Last active March 10, 2020 16:27
Show Gist options
  • Save jll90/5e0549ca5cce5d9c3a65600b29aab9a7 to your computer and use it in GitHub Desktop.
Save jll90/5e0549ca5cce5d9c3a65600b29aab9a7 to your computer and use it in GitHub Desktop.
Chrome Treat Insecure Origin as Secure (useful for SW testing)
#For Ubuntu 16.04 LTS
#First you need to know where google-chrome is installed. To find out run:
which google-chrome
#For my case, google-chrome is installed inside both /usr/bin/google-chrome and /usr/bin/google-chrome-stable.
#I decided to use the stable version.
#Now, list the domains that you'd like chrome to treat as secure. Make sure that you have access to the folder following --user-data-dir. I used $HOME for convenience.
#Run the following command:
/usr/bin/google-chrome-stable --user-data-dir=$HOME --unsafely-treat-insecure-origin-as-secure=http://domain1.dev:8080, http://domain2.dev:8081
#This command will launch an instance of chrome deemed less secure.
#After you're done working close the instance so as to not compromise your security.
#I recommend you to save the previous command to your .bashrc file (or equivalent) by running the following:
echo -n "alias unsafechrome='/usr/bin/google-chrome-stable --user-data-dir=$HOME --unsafely-treat-insecure-origin-as-secure=http://domain1.dev:8080, http://domain2.dev:8081'" >> ~/.bashrc
#Finally, don't forget to source .bashrc, so you can comfortably call unsafechrome.
source ~/.bashrc
#For Mac OSX
open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir=$HOME --unsafely-treat-insecure-origin-as-secure=http://domain.dev:8080
@jdmgarcia
Copy link

Thank you so much! It's working for me perfectly:

open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir=$HOME --unsafely-treat-insecure-origin-as-secure=http://domain.dev:8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment