Add robots.txt and anti-indexation tags.

This commit is contained in:
2019-08-08 21:33:47 +02:00
parent e7583a59c2
commit 781eee090f
3 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
package org.codiki.core.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@RestController
public class RobotsTxtController {
private static final Logger LOG = LoggerFactory.getLogger(RobotsTxtController.class);
@RequestMapping(value = "/robots.txt")
public void robots(HttpServletResponse response) {
try {
response.getWriter().write("User-agent: *\nDisallow: /\n");
} catch (IOException ex) {
LOG.info("Error during robots.txt serving.", ex);
}
}
}

View File

@@ -49,7 +49,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
.antMatchers( .antMatchers(
"/api/account/login", "/api/account/login",
"/api/account/logout", "/api/account/logout",
"/api/account/signin" "/api/account/signin",
"/robots.txt"
).permitAll() ).permitAll()
.antMatchers( .antMatchers(
HttpMethod.GET, HttpMethod.GET,

View File

@@ -3,7 +3,8 @@
<head> <head>
<title>Codiki</title> <title>Codiki</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<base href="/" /> <base href="/" />
<link rel="icon" type="image/x-icon" href="assets/images/favicon.png" /> <link rel="icon" type="image/x-icon" href="assets/images/favicon.png" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" /> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />