Author Topic: Enable CORS  (Read 13401 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Enable CORS
« on: November 17, 2014, 03:46:25 PM »
I have recompiled apache to include the headers module and it worked fine.
But when I add
Header set Access-Control-Allow-Origin "*"
to the httpd.conf file, nothing changes?
I still can't get cors enabled.

thanks

Offline
*
Re: Enable CORS
« Reply #1 on: November 18, 2014, 12:25:49 AM »
can you provide the full paths of the files which you are editing, this is very important?
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: Enable CORS
« Reply #2 on: March 22, 2016, 02:28:14 PM »
I'm wanting to enable CORs too.. But Mod_headers isn't included in apache, and I'm having the hardest trouble trying to add that module somehow.

I'm basically wanting to be able to put this in the vhosts or httpd.conf
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin: *
</IfModule>

But apache doesn't have mod_headers.c

so I search for it and make a file and paste the contents of mod_headers.c
I then do
/usr/local/apache/bin/apxs -c mod_headers.c

To try adding it to apache and it goes through some of the process, but stops with a bunch of errors

Quote
/usr/local/apache/bin/apxs -c mod_headers.c
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_headers.so /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp mod_headers.so /usr/lib64/httpd/modules/
libtool: install: cp mod_headers.so /usr/lib64/httpd/modules/mod_headers.so
cp: cannot stat `mod_headers.so': No such file or directory
apxs:Error: Command failed with rc=65536
.
[root@mail ~]# /usr/local/apache/bin/apxs -c mod_headers.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/local/apache/include  -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_headers.lo mod_headers.c && touch mod_headers.slo
mod_headers.c:84:21: error: ap_expr.h: No such file or directory
mod_headers.c:133: error: expected specifier-qualifier-list before 'ap_parse_node_t'
mod_headers.c: In function 'header_inout_cmd':
mod_headers.c:401: error: 'ap_parse_node_t' undeclared (first use in this function)
mod_headers.c:401: error: (Each undeclared identifier is reported only once
mod_headers.c:401: error: for each function it appears in.)
mod_headers.c:401: error: 'expr' undeclared (first use in this function)
mod_headers.c:508: error: 'header_entry' has no member named 'expr'
mod_headers.c: In function 'do_headers_fixup':
mod_headers.c:647: error: 'header_entry' has no member named 'expr'
mod_headers.c:649: error: 'header_entry' has no member named 'expr'
mod_headers.c:650: error: 'ap_expr_string' undeclared (first use in this function)
mod_headers.c: At top level:
mod_headers.c:911: warning: data definition has no type or storage class
mod_headers.c:911: warning: parameter names (without types) in function declaration
mod_headers.c:911: error: function 'AP_DECLARE_MODULE' is initialized like a variable
mod_headers.c:913: error: invalid initializer
mod_headers.c:913: error: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:913: warning: excess elements in scalar initializer
mod_headers.c:913: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:914: warning: excess elements in scalar initializer
mod_headers.c:914: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:915: warning: excess elements in scalar initializer
mod_headers.c:915: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:916: warning: excess elements in scalar initializer
mod_headers.c:916: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:917: warning: excess elements in scalar initializer
mod_headers.c:917: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:918: warning: excess elements in scalar initializer
mod_headers.c:918: warning: (near initialization for 'AP_DECLARE_MODULE')
mod_headers.c:920: warning: excess elements in scalar initializer
mod_headers.c:920: warning: (near initialization for 'AP_DECLARE_MODULE')
apxs:Error: Command failed with rc=65536


My CWP loaded modules

Quote
Loaded Modules:
 core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 include_module (static)
 filter_module (static)
 deflate_module (static)
 log_config_module (static)
 env_module (static)
 unique_id_module (static)
 setenvif_module (static)
 version_module (static)
 ssl_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 suexec_module (static)
 cgi_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 rewrite_module (static)
 so_module (static)
 cloudflare_module (shared)
 h264_streaming_module (shared)
 flvx_module (shared)
 rpaf_module (shared)
 suphp_module (shared)



Headers nowhere to be found. I'd appreciate any help to get this working so I can add headers again, via vhosts, httpd.conf, and htaccess
Trying to help people :)
Chords and Lyrics

Offline
*
Re: Enable CORS
« Reply #3 on: March 24, 2016, 01:15:14 AM »
you should use apache rebuilder tool to rebuild apache with additional required mods.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services