Mobile app version of vmapp.org
Login or Join
Hamaas447

: How to verify a website powered by Google App Engine backend site to Google Webmaster Tools? I have my backend servlet like following : public class BackendServlet extends HttpServlet {

@Hamaas447

Posted in: #GoogleAppEngine #GoogleSearchConsole #Java #SiteVerification

I have my backend servlet like following :

public class BackendServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

private static final Logger LOG = Logger.getLogger(BackendServlet.class.getName());

@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
LOG.info("backend");
}
}


And then I put the Google verification html file into my project root folder. And I also use Google OAuth2 for the front end. Then I verify it using webmaster tools, but it's said:


Reverification failed. Your verification file redirects to a disallowed location


And so I tried the alternative method, by using the meta-tag. I included the meta-tag that given on the webmaster page into the BackendServlet class as following :

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/html");
resp.setCharacterEncoding("UTF-8");
PrintWriter writer = resp.getWriter();
writer.println("<!doctype html><html><head>");
writer.println("<meta name="google-site-verification" content="verification_string_here" />");
writer.println("<title>backend</title>");
writer.println("</head><body></body></html>");
}


Then again I verify it, but it still gave me an error like following :


Verification failed. We couldn't find the verification meta tag.


Would anyone be so kindly to tell me what I did wrong and what I should do to get my backend site got verified by Google Webmaster Tools?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamaas447

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

Google app engine has documentation for static files. Treat your googleXXXXXXXXXXXX.html verification file as a static file:


By default, all files in the WAR are treated as both static files and resource files, except for JSP files


So just put that file into the root of your war file.

If for some reason you have configured HTML to be non-static, the documentation has XML snippets you can use to make the file static again:

<static-files>
<include path="google*.html" />

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme