Forum Discussion
Serving static web content from a subdoamin
Hi.
Situation:
Currently the virtual server is serving all files (static and dynamic) with persistent cookies and all files are coming from one domain. For example http://www.example.com/images/logo.jpg or http://www.example.com/css/style.css
Goal:
Serve the static files from a cookieless domain for example http://images.example.com/logo.jpg this will also benefit the browsers enabling more concurent connections. I have already rewritten all the URLs in html and css files to request from the cookieless subdomains. http://css.example.com/style.css
I have already:
- registered the DNS for images.example.com and it resolves ok
- created a virtual server that will server WITHOUT persistent cookies
-
created a data group like:
- images.example.com -> /images
- css.example.com -> /css
- The www.example.com virtual server uses the pool name main_site_pool
What would the iRule be?
3 Replies
- Mohamed_Lrhazi
Altocumulus
What would the iRule do? - What_Lies_Bene1
Cirrostratus
Indeed. What's an iRule needed for? I don't see why you'd need one. Just use a different pool on the other VS that's serving the image and css files.
- mindprint_15295
Nimbostratus
Got it working with following code:
when HTTP_REQUEST { set active_pool_name "main_site_pool" set actual_host_name "www.example.com" if {[matchclass [HTTP::host] eq static_content_route_class ]} { pool "$active_pool_name" HTTP::header replace Host "$actual_host_name" } }Is there a better solution?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com