Commit e1fa53c5 authored by Matija Obreza's avatar Matija Obreza
Browse files

Deny all in robots.txt

parent 233a21a8
......@@ -37,13 +37,20 @@ public class RobotsTxtController {
@Value("${base.host}")
private String host;
@Value("${robots.allow}")
private boolean allowRobots;
private static final String ROBOTS_ALLOW_ALL = "User-Agent: *\nAllow: /";
private static final String ROBOTS_DENY_ALL = "User-Agent: *\nDisallow: /";
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody
String robotsTxt(HttpServletResponse response, HttpServletRequest request) {
public @ResponseBody String robotsTxt(HttpServletResponse response, HttpServletRequest request) {
response.setContentType("text/plain");
if (!allowRobots) {
return ROBOTS_DENY_ALL;
}
String reqHost = request.getHeader("Host");
if (StringUtils.isNotBlank(reqHost) && StringUtils.contains(reqHost, ":")) {
reqHost = reqHost.substring(0, reqHost.indexOf(":"));
......
......@@ -21,6 +21,9 @@ base.cookie-domain=
base.cookie-secure=false
base.cookie-http-only=false
# robots.txt
robots.allow=false
db.url=jdbc:mysql://localhost/genesys20150630?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
db.driverClassName=com.mysql.jdbc.Driver
db.username=root
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment