I'm looking for a little script using nc
which will be used to add CORS headers (at least Access-Control-Allow-Origin: *
) in order for my local ionic dev application to access a remote webservice.
Anthony O.'s questions
After a2enmod rewrite
, I wrote the file /etc/apache2/conf-available/myspecific_rewrite.conf
:
RewriteEngine on
RewriteRule ^/test(/.*)?$ http://anothersite.tld/test$1 [R]
RewriteRule ^/test2(/.*)?$ http://anothersite2.tld/test [R]
Then I a2enconf myspecific_rewrite
and the correct symbolic link is created in /etc/apache2/conf-enabled
.
The problem is that this conf doesn't work : the rewrite is not active.
I want that rewrite to be active for all my virtual hosts. This file I wrote defines RewriteRule
s outside of a <VirtualHost>
... is there a way to make it working?
I must add an organizationalunit
like this into a freshly installed OpenLDAP (on Ubuntu 12.04) :
dn: ou=MYREGION, ou=MYAPP, ou=GROUPS, o=myorganization, c=fr
ou: MYREGION
objectClass: top
objectClass: organizationalunit
So as it's a new LDAP, I think I must first add the fr
country, and I create that file :
dn: c=fr
c: fr
objectClass: top
objectClass: country
Now I try to import it with that command (I have no domain for that server) :
ldapadd -x -D cn=admin,dc=nodomain -W -f country_fr.ldif
but OpenLDAP rejects that command with :
adding new entry "c=fr"
ldap_add: Server is unwilling to perform (53)
additional info: no global superior knowledge
Any hint?
Does someone know how to use Squid to proxify maven repositories ?
What are the configuration files for that ?
The main problem is that maven client issue HTTP request with headers which control the cache behavior (and I want to bypass that).
Here is a typical request :
GET /maven/proxy/jboss-public/org/richfaces/richfaces-bom/4.2.0.Final/richfaces-bom-4.2.0.Final.pom HTTP/1.1
Cache-control: no-cache
Cache-store: no-store
Pragma: no-cache
Expires: 0
Accept-Encoding: gzip
User-Agent: Apache-Maven/3.0.4 (Java 1.6.0_26; Linux 2.6.32-38-generic)
Host: 192.168.2.171
Connection: Keep-Alive
I'm already using Apache HTTPD (and disk_cache
proxy_http
modules enabled) for that, but I'm creating a mirror, not a proxy.
Here is the configuration (based on that site) :
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# central
ProxyPass /maven/proxy/central http://repo1.maven.org/maven2
ProxyPassReverse /maven/proxy/central http://repo1.maven.org/maven2
CacheEnable disk /maven/proxy/central
# jboss-public-repository-group
ProxyPass /maven/proxy/jboss-public http://repository.jboss.org/nexus/content/groups/public
ProxyPassReverse /maven/proxy/jboss-public http://repository.jboss.org/nexus/content/groups/public
ProxyPassReverseCookiePath /nexus /maven/proxy/jboss-public
CacheEnable disk /maven/proxy/jboss-public
# codehaus
ProxyPass /maven/proxy/codehaus http://repository.codehaus.org/
ProxyPassReverse /maven/proxy/codehaus http://repository.codehaus.org/
CacheEnable disk /maven/proxy/codehaus
CacheDirLength 2
CacheDirLevels 3
# Override default cache expiration and control
CacheDefaultExpire 2419200
CacheMaxExpire 2419200
# Ignore requests to not serve from cache. Maven data never changes.
CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheStoreNoStore On
# Default max file size is 64K. Set to 1GB.
CacheMaxFileSize 1073741824
I first wrote my problem on stackoverflow thinking it was a Maven proxy software problem.
But I realised it was more a problem with my virtualization stack (libvirt 0.7.5-5ubuntu27.19 / kvm 1:84+dfsg-0ubuntu16+0.12.3+noroms+0ubuntu9.16 on Ubuntu 10.04.3 LTS).
Here is the libvirt network configuration of my VM :
<interface type='bridge'>
<mac address='52:54:00:0f:30:ea'/>
<source bridge='br0'/>
</interface>
And the /etc/network/interfaces
part for br0
:
auto eth3
iface eth3 inet manual
auto br0
iface br0 inet static
address 192.168.1.200
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
bridge_ports eth3
bridge_stp off
bridge_maxwait 0
So here is the problem : sometimes, when a maven client is trying to build a project and downloads plenty of jars from the VM running the maven proxy, it stucks while downloading one of them :
Downloading: http://192.168.1.213:8081/artifactory/repo/org/apache/apache/9/apache-9.pom
Downloaded: http://192.168.1.213:8081/artifactory/repo/org/apache/apache/9/apache-9.pom (15 KB at 14.0 KB/sec)
Downloading: http://192.168.1.213:8081/artifactory/repo/org/apache/maven/plugins/maven-release-plugin/2.2.1/maven-release-plugin-2.2.1.jar
5 KB
I've eliminated the software problem because I configured a similar server on another real computer and it works.
I've tried switching ip_forward
to 0
reading Network freezes with KVM/libvirt and ip_forward = 1 without result.
I've tried adding CAP_NET_ADMIN
capability reading KVM/Networking on ubuntu wiki without results.
I've tried to configure my br0
adding those properties in /etc/network/interfaces
without results :
bridge_fd 9
bridge_fd 0
bridge_hello 2
bridge_maxage 12
(Also tried bridge_stp on
)
I've tried to change the model of the virtual network interface reading that blog entry, adding <model type='e1000'/>
inside the <interface>
tag, and I finally had better results (but it still blocked sometimes - even if it's less often). Better also with rtl8139
model.
I've tried to capture the exchange between my client and the VM, and it seems to stuck always when TCP connection client send a [ACK]
with a Len=0
. Here is the exchange captured by Wireshark.
It seems I have the same bug as this one (on launchpad).
Can somebody point me to an even better libvirt / KVM configuration ?