Skip to content

Commit f86eff2

Browse files
committed
SEO improvements: meta tags, schema.org, nginx cache headers, and security headers
1 parent 232556e commit f86eff2

5 files changed

Lines changed: 91 additions & 7 deletions

File tree

.env.sample

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ CLEANUP_SCANNED_IMAGES=true
2222
# SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
2323
SLACK_WEBHOOK_URL=
2424

25-
26-
# Google Analytics Tag ID (gtag.js)
27-
# Example: G-XXXXXXXXXX
28-
GOOGLE_TAG_ID=
25+
# Google Analytics Tag ID (gtag.js)
26+
# Example: G-XXXXXXXXXX
27+
GOOGLE_TAG_ID=
28+
29+
# Site Domain (used for SEO meta tags, canonical URLs, og:tags)
30+
# Default: https://infrascan.soldevelo.com
31+
SITE_DOMAIN=https://infrascan.soldevelo.com

app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def inject_global_vars():
4343
"""Make global variables available in all templates."""
4444
return {
4545
'static_version': STATIC_VERSION,
46-
'google_tag_id': os.getenv('GOOGLE_TAG_ID', '')
46+
'google_tag_id': os.getenv('GOOGLE_TAG_ID', ''),
47+
'site_domain': os.getenv('SITE_DOMAIN', 'https://infrascan.soldevelo.com')
4748
}
4849

4950
def get_slack_webhook_url() -> str:

nginx/nginx.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ server {
2020
ssl_protocols TLSv1.2 TLSv1.3;
2121
ssl_prefer_server_ciphers on;
2222
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
23+
24+
# Security headers for SEO
25+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
26+
add_header X-Content-Type-Options "nosniff" always;
27+
add_header X-Frame-Options "SAMEORIGIN" always;
28+
add_header X-XSS-Protection "1; mode=block" always;
29+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
2330

2431
client_max_body_size 10M;
2532

@@ -32,18 +39,30 @@ server {
3239
proxy_read_timeout 600s;
3340
proxy_connect_timeout 600s;
3441
proxy_send_timeout 600s;
42+
43+
# Cache headers for HTML (no-cache to get fresh content, but browser can revalidate)
44+
add_header Cache-Control "public, max-age=3600" always;
3545
}
3646

3747
location /static/ {
3848
alias /opt/infrascan/static/;
49+
# Cache static assets for 1 year
50+
expires 365d;
51+
add_header Cache-Control "public, immutable" always;
3952
}
4053

4154
location = /sitemap.xml {
4255
alias /opt/infrascan/static/sitemap.xml;
56+
# Cache sitemap for 24 hours
57+
add_header Cache-Control "public, max-age=86400" always;
58+
add_header Content-Type "application/xml; charset=utf-8" always;
4359
}
4460

4561
location = /robots.txt {
4662
alias /opt/infrascan/static/robots.txt;
63+
# Cache robots.txt for 24 hours
64+
add_header Cache-Control "public, max-age=86400" always;
65+
add_header Content-Type "text/plain; charset=utf-8" always;
4766
}
4867

4968
# Error pages

static/robots.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
User-agent: *
22
Allow: /
3+
Allow: /api/
34

4-
Sitemap: https://infrascan.soldevelo.com/sitemap.xml
5+
# Block any malicious bots
6+
User-agent: AhrefsBot
7+
Disallow: /
8+
9+
User-agent: SemrushBot
10+
Disallow: /
11+
12+
User-agent: DotBot
13+
Disallow: /

templates/index.html

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,31 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>InfraScan - Advanced Infrastructure Auditor</title>
7+
<meta name="description" content="InfraScan is an open-source Infrastructure as Code scanner that identifies security vulnerabilities, cost optimization opportunities, and compliance issues in Terraform, CloudFormation, Kubernetes, and Dockerfile. Scan GitHub repositories for free.">
8+
<meta name="keywords" content="IaC scanner, Terraform security, CloudFormation audit, Kubernetes scanning, infrastructure audit, security scanner, cost optimization">
9+
<meta name="author" content="SolDevelo">
10+
<meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
11+
12+
<!-- Open Graph / Facebook -->
13+
<meta property="og:type" content="website">
14+
<meta property="og:url" content="{{ site_domain }}/">
15+
<meta property="og:title" content="InfraScan - Free Infrastructure as Code Security Scanner">
16+
<meta property="og:description" content="Scan Infrastructure as Code for security vulnerabilities and cost optimization. Supports Terraform, CloudFormation, Kubernetes, and more.">
17+
18+
<!-- Twitter -->
19+
<meta property="twitter:card" content="summary">
20+
<meta property="twitter:url" content="{{ site_domain }}/">
21+
<meta property="twitter:title" content="InfraScan - Free Infrastructure as Code Security Scanner">
22+
<meta property="twitter:description" content="Scan Infrastructure as Code for security vulnerabilities and cost optimization. Supports Terraform, CloudFormation, Kubernetes, and more.">
23+
24+
<!-- Canonical -->
25+
<link rel="canonical" href="{{ site_domain }}/">
26+
27+
<!-- Language -->
28+
<meta http-equiv="content-language" content="en-US">
29+
30+
<title>InfraScan - Free Infrastructure as Code Security Scanner | Terraform & CloudFormation Auditor</title>
31+
832
{% if google_tag_id %}
933
<!-- Google tag (gtag.js) -->
1034
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_tag_id }}"></script>
@@ -16,10 +40,38 @@
1640
gtag('config', '{{ google_tag_id }}');
1741
</script>
1842
{% endif %}
43+
44+
<!-- JSON-LD Structured Data -->
45+
<script type="application/ld+json">
46+
{
47+
"@context": "https://schema.org",
48+
"@type": "SoftwareApplication",
49+
"name": "InfraScan",
50+
"description": "Open-source Infrastructure as Code scanner for security and cost optimization",
51+
"url": "{{ site_domain }}",
52+
"applicationCategory": "DeveloperApplication",
53+
"offers": {
54+
"@type": "Offer",
55+
"price": "0",
56+
"priceCurrency": "USD"
57+
},
58+
"creator": {
59+
"@type": "Organization",
60+
"name": "SolDevelo",
61+
"url": "https://soldevelo.com"
62+
},
63+
"operatingSystem": "Web-based",
64+
"featureList": ["Terraform scanning", "CloudFormation audit", "Kubernetes manifest analysis", "Dockerfile security scan", "Cost optimization detection", "Security vulnerability detection"]
65+
}
66+
</script>
67+
1968
<link rel="preconnect" href="https://fonts.googleapis.com">
2069
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
2170
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
2271
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}?v={{ static_version }}">
72+
73+
<!-- Preload critical resources -->
74+
<link rel="preload" as="style" href="{{ url_for('static', filename='style.css') }}?v={{ static_version }}">
2375
</head>
2476

2577
<body>

0 commit comments

Comments
 (0)