Add robots.txt and anti-indexation tags.
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Codiki</title>
|
<title>Codiki</title>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="robots" content="noindex, nofollow" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<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" />
|
||||||
|
|||||||
Reference in New Issue
Block a user