Skip to content

Instantly share code, notes, and snippets.

@virbo
Created January 28, 2019 05:42
Show Gist options
  • Save virbo/d1c0c77b6449b18b1439a0cd6bbb735e to your computer and use it in GitHub Desktop.
Save virbo/d1c0c77b6449b18b1439a0cd6bbb735e to your computer and use it in GitHub Desktop.
# Add these three lines to CORSify your server for everyone.
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"

CORSify a folder in Apache

Add the above three lines to an .htaccess file to enable CORS for that folder and its subfolders. Of course, you could also add this to the httpd.conf file if you have access.

###Notes:

  • Ensure that the mod_headers Apache Module is enabled.
  • This will open things up pretty grandly. This may or may not be what you want.

###Disclaimer

  • Do at your own risk, etc. etc.
  • My Apache-fu is weak, so there may well be a better solution.

Source: https://gist.github.com/nixta/0b98d7975562bc31c4c9

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