Search code examples
wicketsession-statejsessionid

wicket sessions: how to prevent "jsessionid" from showing up in googlebot crawl results?


When google crawls our site the resulting URLs all have the jsessionid appended to them. Is this happening because the app server is detecting a lack of cookie support in Googlebot, forcing the session to be maintained via URL-rewriting? Is there anything I can do about it?

Is the solution simply to never call Component.getSession() ? Is there anything like HttpServletRequest.getSession(false) ?

Edit: just found org.apache.wicket.Session.exists()


Solution

  • Found the solution in SEO - Search Engine Optimization - Apache Wicket Wiki.

    In a nutshell:

    • override WebApplication.newWebResponse()
    • have it return a BufferedWebResponse that checks to see if the user-agent is a crawler (i.e. googlebot) or not
    • if it's a crawler, don't re-write the URL