Skip to content

Commit

Permalink
fix: common traffic
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfromyeg committed Dec 31, 2023
1 parent 9b6aea9 commit 1007772
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bereal/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ def get_video(filename: str) -> tuple[Response, int]:
return send_from_directory(EXPORTS_PATH, filename, mimetype="video/mp4"), 200


@app.route("/robots.txt")
def robots_txt() -> tuple[Response, int]:
return send_from_directory(app.static_folder, request.path[1:]), 200


@app.route("/favicon.ico")
def favicon():
return send_from_directory(app.static_folder, "favicon.ico", mimetype="image/vnd.microsoft.icon")
Expand Down
2 changes: 2 additions & 0 deletions bereal/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
20 changes: 20 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ server {
ssl_certificate /etc/letsencrypt/live/api.bereal.michaeldemar.co/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.bereal.michaeldemar.co/privkey.pem;

# Drop requests to common WordPress paths
location ~* /wp-admin {
return 444;
}
location ~* /wp-login.php {
return 444;
}
location ~* /wp-includes {
return 444;
}
location ~* /wp-content {
return 444;
}
location ~* /xmlrpc.php {
return 444;
}
location ~* /wp-json {
return 444;
}

# web and port are from the service's definition in docker-compose
location / {
proxy_pass http://web:5000;
Expand Down

0 comments on commit 1007772

Please sign in to comment.