Mobile app version of vmapp.org
Login or Join
Cofer257

: Apache Rewrites not working due to Akamai I have a website which is setup with akamai. My domain and subdomains are mapped onto an Akamai IP. I have written an Apache rewrite which does an

@Cofer257

Posted in: #Apache #UrlRewriting

I have a website which is setup with akamai. My domain and subdomains are mapped onto an Akamai IP.

I have written an Apache rewrite which does an internal URL X to another internal URL Y. This rewrite works fine as long as I am testing in my local setup or for those subdomains which are not mapped onto Akamai but directly onto my Public IP.

My suspicion is that while rewriting the request apache is not able to resolve the IP of the app server correctly.

When I add entries to my /etc/hosts file pointing the domain/subdomain to my internal IP the rewrites work.

Now, I have a huge list of subdomains and it can grow as well. Is there another way to fix this problem without having to make entries in the /etc/hosts file ?

I would much appreciate your thoughts.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Cofer257

2 Comments

Sorted by latest first Latest Oldest Best

 

@Carla537

I'm actually quite surprised to hear that the rewrite rule you say you have:

RewriteRule ^/(context)/(sub-context)(-)([-a-z0-9A-Z]*)/(.*)$ /// [P,L]


works at all, since according to the documentation it shouldn't:


"^/somepath(.*) /otherpath [P]     doesn't make sense, not supported"


If you want to use the [P] flag, your rewrite target should be a full URL. However, I very much suspect that the [P] flag is, in fact, not what you want, and that removing it might fix the problem.

10% popularity Vote Up Vote Down


 

@Miguel251

Yes - use a different DNS server, or re-write the URL to use a hostname which works correctly.

However the net effect is the same as changing the entry in your hosts file. But if you are not sending back a redirect from the rewrite, then you'll get marginally better performance by using the loopback adapter rather than (the address of a) real NIC. So just put it in you hosts file as 127.0.0.1 but more importantly this address should never change.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme