Permanent (301 Redirect) from Jelly? Or: How to Modify HTTP Headers from a UI Page

Jon Lind3
Kilo Contributor

Is there a way to modify the headers of a response when hitting an old-school Jelly UI Page? 

If I could just insert a single "301 Moved Permanently" header into the HTTP response before redirecting to the new URL it would save our place in the Google search indexes and thus save our students and faculty so much time and aggravation.

We have a public facing Knowledge base built on the old CMS that's used by tens of thousands of students at a massive university.  We are moving to a new Service Portal based site but the existing KB is indexed by Google using an address like "ka_home.do?sys_id=".  We would like to return a permanent 301 Redirect when a user hits the old URL to take them to the new "/sp" address.

1 ACCEPTED SOLUTION

Jace Benson
Mega Sage

You can do this with the old processors.

This is good post about it.  http://www.john-james-andersen.com/blog/service-now/create-your-own-rest-based-servicenow-web-servic...

Offical Docs(not as good) https://docs.servicenow.com/bundle/london-application-development/page/script/processors/reference/r...

Based on what I've done you should be able to make a processor at called 'ka' and that will hit the processor.

Then have it's g_response set the status like noted here: https://community.servicenow.com/community?id=community_question&sys_id=2bfdc7addb9cdbc01dcaf3231f96...

 

g_response.status = 400

View solution in original post

3 REPLIES 3

Jace Benson
Mega Sage

You can do this with the old processors.

This is good post about it.  http://www.john-james-andersen.com/blog/service-now/create-your-own-rest-based-servicenow-web-servic...

Offical Docs(not as good) https://docs.servicenow.com/bundle/london-application-development/page/script/processors/reference/r...

Based on what I've done you should be able to make a processor at called 'ka' and that will hit the processor.

Then have it's g_response set the status like noted here: https://community.servicenow.com/community?id=community_question&sys_id=2bfdc7addb9cdbc01dcaf3231f96...

 

g_response.status = 400

Jon Lind3
Kilo Contributor

Clever idea!  I love the low-level access to the HTTP lifecycle you have in processors. 

Didn't even realize that I could get the processors into my CMS site's path (e.g. /cms/kahome.do).  

Cuneyt
Tera Contributor

Hi, we have the similiar issue. The "/sp" portal page is redirected from "/" with 302 response. This is effecting the Google. Do you have any suggestions like how did you solved your issue ? Because we can't add a path or parameter because it is simply redirected from "/". This is what we understood, do you have any idea about this ?