Control Web Panel

WebPanel => Apache => Topic started by: Diego on November 17, 2014, 03:46:25 PM

Title: Enable CORS
Post by: Diego 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
Title: Re: Enable CORS
Post by: Administrator 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?
Title: Re: Enable CORS
Post by: MyBuddyBen 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
Title: Re: Enable CORS
Post by: Administrator on March 24, 2016, 01:15:14 AM
you should use apache rebuilder tool to rebuild apache with additional required mods.