Need to remove header response on server paramter that cq provides | Community
Skip to main content
New Participant
October 16, 2015
Solved

Need to remove header response on server paramter that cq provides

  • October 16, 2015
  • 9 replies
  • 3652 views

Hi,

 
I need to remove the header response on server details  that cq would add on each response provided by server.
 
I thought of adding the required  code in global.jsp
 
if anyone thinks other wise please suggest
 
Thanks,
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Peter_Puzanovs

Are you using Dispatcher in front of your Publisher?

Can you use Apache 2 Header unset command to be sure it's always removed on * requests?

Header unset SERVER

Thanks,

Peter

9 replies

Peter_Puzanovs
New Participant
October 16, 2015

Hi Srinivas,

Yes, have added custom headers in the past and removed headers too.

Never tried to stick it into .any file. In pre-production environment add configuration to dispatcher.any, restart apache2 process.

See if it works the way you want.

Thanks,

Peter

New Participant
October 16, 2015

Hi Peter,

 

Thanks for the input.Did you see that in cq5 dispatcher  can do any change to make this happen??

 

The reason we have the Apache used by other applications also .Hence wanted suggestion if this can be done at dispatcher.any

 

Thanks

Peter_Puzanovs
New Participant
October 16, 2015

On linux: Put the rule in the httpd.conf within your <VirtualHost tag.

Thanks,

Peter

New Participant
October 16, 2015

Hi Peter,

you suggestion is really useful. We use dispatcher and also Apache and 

could you please provide more details as which Apache file and any sample sinpet which i could use for testing

 

Thanks

New Participant
October 16, 2015

Any inputs

smacdonald2008
New Participant
October 16, 2015

If you do not want an HTTP Header response -- you can write a custom Sling Servlet that can sets the HTTP Header Response. 

See: 

http://stackoverflow.com/questions/19552543/how-to-set-header-in-http-response

http://www.informit.com/articles/article.aspx?p=29817&seqNum=8

kautuk_sahni
Employee
October 16, 2015

Hi

Apart from what Scott has mentioned, We can modify response directly from JSP.

LINK:- http://www.tutorialspoint.com/jsp/jsp_server_response.htm

 

Please share your use case for the same

 

Thanks and Regards

Kautuk Sahni 

Kautuk Sahni
New Participant
October 16, 2015

I currently see that when cq provides any respose from server in header details the "SERVER" parmeter is coming up.It clears gives the  details on the server  we 
use which is not  pratice as hackers can manipulate.So want  to restrict it. So i see that any jsp we use we add global.jsp  else we need to find the jsp we need
to remove the header details.

So i am plannig to add the below code in global.jsp
<%=response.setHeader("SERVER", ""); %>


please let me know if have any other thoughts

Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
October 16, 2015

Are you using Dispatcher in front of your Publisher?

Can you use Apache 2 Header unset command to be sure it's always removed on * requests?

Header unset SERVER

Thanks,

Peter