Hi All
We need to access a specific page directly from the publish instance without using the dispatcher, while allowing other pages to continue being served through the dispatcher.
How to do that ? can you anyone pls provide details ..
Thanks
Kannan
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @KNan ,
You can achieve this in multiple ways:
The /rules property controls which documents are cached according to the document path. Regardless of the /rules property, Dispatcher never caches a document in the following circumstances:
Request URI contains a question mark (?).
The file extension is missing.
The authentication header is set (configurable).
If the AEM instance responds with the following headers:
If you want handle this through AEM backend then below are the 2 options.
1. At component level component model class.
@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class Component{
@Inject
private SlingHttpServletResponse response;
@PostConstruct
protected void init() {
response.setHeader("Dispatcher", "no-cache");
}
}
2. At page level, now you can call this page in body html based on some condition:
@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class PageMOdel {
@Inject
private SlingHttpServletResponse response;
@PostConstruct
protected void init() {
response.setHeader("Dispatcher", "no-cache");
}
}
Hello
you can access a specific page directly from the publish instance, you can directly use the publish instance URL followed by the page's path. but generally bypassing the dispatcher isn't usually recommended for a production environment for multiple reasons like Caching and Load Balancing etc.
if you still want to access the specific page you can try the below approach
http://<publish-server-ip>:<port>/content/project/test.html
Replace <publish-server-ip> and <port> with the IP and port number for your publish instance.
Thanks,
Venkat
Hi @KNan ,
To bypass a specific page from dispatcher you can do the following.
I am assuming the page to bypass is '/content/myProject/us/en/home'
APPROACH 1
1. Access your dispatcher configuration file (often named dispatcher.any).
2. Add a rule to exclude caching for the specific page. This prevents the dispatcher from intercepting requests for this page.
/excludePage
{
/glob "/content/myProject/us/en/home"
}
/excludePage: This directive is used to define URLs that should be excluded from the dispatcher.
APPROACH 2
You can set up a rule within the /filter section to bypass the dispatcher for a particular URL.
/filter
{
/0001
{
/glob "/content/myProject/us/en/home*"
/type "deny"
}
}
Thanks
Hi @KNan ,
You can achieve this in multiple ways:
The /rules property controls which documents are cached according to the document path. Regardless of the /rules property, Dispatcher never caches a document in the following circumstances:
Request URI contains a question mark (?).
The file extension is missing.
The authentication header is set (configurable).
If the AEM instance responds with the following headers:
If you want handle this through AEM backend then below are the 2 options.
1. At component level component model class.
@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class Component{
@Inject
private SlingHttpServletResponse response;
@PostConstruct
protected void init() {
response.setHeader("Dispatcher", "no-cache");
}
}
2. At page level, now you can call this page in body html based on some condition:
@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class PageMOdel {
@Inject
private SlingHttpServletResponse response;
@PostConstruct
protected void init() {
response.setHeader("Dispatcher", "no-cache");
}
}
Hi @KNan ,
I think you can use ignoreUrlParams which helps to by pass the despatcher cache.
/ignoreUrlParams
{
/001{ /glob "*" /type "allow"}
/002 { /glob "specific page ID" /type "deny"}
}
with above rule, URL having that specific page ID always fetches the latest content from the AEM instance.
@KNan Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies