Forum Moderators: phranque

Message Too Old, No Replies

browser (not) caching and wildcard subdomain

browser cache wildcard subdomain

         

hendrakieran

8:08 am on Nov 13, 2007 (gmt 0)

10+ Year Member



Hi Guys,

Here's my situation:

- I'm using wildcard DNS to allow users going to [username.example.com...]
- In my apache2 server, there's a flash app that will extract subdomain (i.e username) and display the content accordingly, specific to that user (content taken from app server but that's irrelevant here)
- This URL [fixedsubdomain.example.com...] also supported and will give the same output

Now my problem:
- The browser doesn't cache the flash file coz it sees the URL as different one whenever another subdomain is typed. For example, when first time visiting the site [abc.example.com,...] it will download the flash file and display content of user abc. Immediately after that, visiting [xyz.example.com...] will also download the same flash file (it's a static file by itself). It seems like browser can't cache based on domain name only, ignoring the subdomain.

- I can forward/rewrite [abc.example.com...] to [fixedsubdomain.example.com...] and this way the browser will cache the flash file, but i want the URL shown in the address bar as [abc.example.com....] Is this possible?

Can anyone think of any solution to this?

Thanks in advance!

H

phranque

10:17 am on Nov 13, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



try using an absolute (fully qualified using fixedsubdomain) url for the flash file instead of a relative url.

hendrakieran

12:51 pm on Nov 13, 2007 (gmt 0)

10+ Year Member



then it won't be "cool" isn't it? ;)

the idea is quite simple, basically i just need to keep the subdomain.example.com shown on the address bar while benefiting from the browser cache. if only there's an option to cache based on domain name only and ignoring the subdomain. hmm...

jdMorgan

1:07 pm on Nov 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> if only there's an option to cache based on domain name only and ignoring the subdomain.

There is, and cannot be, such an option. Otherwise, sites like Google would get badly broken when the browser confused content from www.google.com with content from search.google.com and m.google.com. Caches are required to use the FQDN and the full URL to maintain cache coherency.

It's not clear why this is a problem though, because it seems unlikely that one user could benefit from another user's browser cache.

Jim

hendrakieran

2:10 pm on Nov 13, 2007 (gmt 0)

10+ Year Member



what you mentioned abt how one user benefit from another user's cache make sense, but in my case, they are static data:

1. the index.html that act as a wrapper and call the flash file
2. the flash file, which by itself is static

am i making sense? ;)

phranque

3:57 pm on Nov 13, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



why can't you have [username.example.com...] be the wrapper and [fixedsubdomain.example.com...] as the embedded object for every username?
it would still show username in the browser address bar...

hendrakieran

4:46 pm on Nov 13, 2007 (gmt 0)

10+ Year Member



hmm.. thanks, great idea.. that might work, why didn't i think of that!
so i assume by doing this, only the index.html won't be cached, but the flash file will since it'll be always from the same, fixed, URL?

can anyone confirm this?

hendrakieran

2:44 am on Nov 14, 2007 (gmt 0)

10+ Year Member



oops, that didn't work either. I've point the flash file in a fixed URL within the index.html wrapper, but every time I visit a different subdomain, it will always get downloaded. Visiting subdomain that I visited before gave me the cached flash. Looks like I've ran out of option here :(

Anyway, thanks to all who had replied. I won't give up yet so feel free to suggest if you have any idea ;)