Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Vanity urls on publisher goes 404

Avatar

Level 1

Hi Team,

 

We are creating pages programatically on publisher it self, and setting sling vanity urls. We have observed that few pages working fine but few of them goes 404.

Path pattern is 

Content path is : /content/myproject/products/product-categoty/product.html

Vanity path is : /content/myproject/product.html

 

I have checked the error logs on publisher.

GET /content/myproject/vivoy128gb-storagegold-8gbram.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource/content/myproject/vivoy128gb-storagegold-8gbram.html not found

When we travers page through crx/de repository to actual page "/content/myproject/products/product-categoty/product.html" and performed dummy save operation same page started working.

Also another behaviour is after few day's same page went 404, without any content update or any other operation. Then again need to do the same practice.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @VB_Dev First off - why are you creating pages on publish server? I mean the usual approach could have been : create pages on author and then publish it - so that in case you mess up, you can do something about it. If you mess up here - there's very little you can do.

Anyway, second point - 

Resource/content/myproject/vivoy128gb-storagegold-8gbram.html not found

Can you check if you are appending "Resource" with content path by any chance while resolving the pages?


Thanks

-Bilal

 

 

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hello @VB_Dev First off - why are you creating pages on publish server? I mean the usual approach could have been : create pages on author and then publish it - so that in case you mess up, you can do something about it. If you mess up here - there's very little you can do.

Anyway, second point - 

Resource/content/myproject/vivoy128gb-storagegold-8gbram.html not found

Can you check if you are appending "Resource" with content path by any chance while resolving the pages?


Thanks

-Bilal

 

 

 

Avatar

Level 1

If we hit actual content path then page load fine on publisher, but same page we hit through vanity url goes 404.

After digging found that below query only traverse 1 lacks node and my case more than 2 lacks pages with vanity urls present.

 

SELECT sling:vanityPath, sling:redirect, sling:redirectStatus FROM nt:base WHERE sling:vanityPath IS NOT NULL

 

VB_BFDL_0-1693382917757.png

 

Avatar

Community Advisor

Ah! that was the culprit.

If you have not implemented a solution yet, I'd suggest you create a custom oak: index definition.

 

Thanks

-Bilal

Avatar

Community Advisor

Hello @VB_Dev  - 

 

Couple of things here : 

  • I would suggest creating pages first on author (maybe, programmatically as you mentioned) => Page Activation (to publish env)
  • The logs which you have shared above are they that of publisher/dispatcher? As, if you are accessing pages via dispatcher/CDN node caching might have to do something here.