Answers for "how to set cors header in server apache2"

0

apache2 CORS

#####        WORKING ON APACHE2 Unix CONFIGURATION           #####
# To learn more about CORS :                                     #
# https://fr.wikipedia.org/wiki/Cross-origin_resource_sharing    #
# First you need to enable headers_module in your global Apache2 #
# httpd.conf configuration file. To do so, uncomment the line    #
    
 LoadModule headers_module modules/mod_headers.so

# Once it's done, you need to parameter the following statements #
# in your dedicated <Directory> , <Location> , <Files>           #
# or <VirtualHost> .conf file, or inside your project within     #
# .htaccess file                                                 #
    
 Header set Access-Control-Allow-Origin "*"
 Header set Access-Control-Allow-Methods "HEAD, GET, POST, PUT, PATCH, DELETE"
 Header set Access-Control-Allow-Headers "Origin, Content-Type, X-Auth-Token"

# Finally restart your apache server.                            #
# You are free to manipulate other statements, referenced        #
# into the wiki.                                                 #
# This has for effect to manipulate default HTTP Headers sent by #
# your server, in order to communicate with a remote client      #
# browser.                                                       #
Posted by: Guest on March-29-2020

Browse Popular Code Answers by Language