[dpdk-web] [PATCH] use full URLs in error pages

Thomas Monjalon thomas.monjalon at 6wind.com
Tue May 24 21:49:17 CEST 2016


In order to serve 403 and 404 error pages outside of the web
domain, the resources (css/img) must be pointed with an absolute
full URL.
The navigation links are also absolute to provide access to good pages
when trying to access to a wrong sub-domain (e.g. error.dpdk.org).

The page 403 is new and copied from 404.

The full URL is stripped in the local server to be able to test these
pages with local resources.

Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 404.html => 403.html   | 27 ++++++++++++++-------------
 404.html               | 25 +++++++++++++------------
 layout.css             |  2 +-
 scripts/serve_local.py |  2 +-
 4 files changed, 29 insertions(+), 27 deletions(-)
 copy 404.html => 403.html (50%)

diff --git a/404.html b/403.html
similarity index 50%
copy from 404.html
copy to 403.html
index c5f2384..621875e 100644
--- a/404.html
+++ b/403.html
@@ -4,9 +4,9 @@
 		<meta charset="utf-8" />
 		<meta name=viewport content="width=device-width, initial-scale=1" />
 		<title>DPDK 404</title>
-		<link rel="stylesheet" href="/reset.css" />
-		<link rel="stylesheet" href="/layout.css" />
-		<link rel="stylesheet" href="/content.css" />
+		<link rel="stylesheet" href="http://dpdk.org/reset.css" />
+		<link rel="stylesheet" href="http://dpdk.org/layout.css" />
+		<link rel="stylesheet" href="http://dpdk.org/content.css" />
 		<script type="text/javascript">
 			var _gaq = _gaq || [];
 			_gaq.push(['_setAccount', 'UA-39229303-1']);
@@ -22,22 +22,23 @@
 	</head>
 	<body>
 		<header>
-			<h1><a href="http://dpdk.org/"><img src="/dpdk.png" alt="DPDK: Data Plane Development Kit"></a></h1>
+			<h1><a href="http://dpdk.org/"><img src="http://dpdk.org/dpdk.png"
+					alt="DPDK: Data Plane Development Kit"></a></h1>
 			<nav>
 				<ul>
-					<li><a href="/">Home</a></li>
-					<li><a href="/download">Download</a></li>
-					<li><a href="/doc">Documentation</a></li>
-					<li><a href="/dev">Development</a></li>
-					<li><a href="/ml">Mailing Lists</a></li>
-					<li><a href="/events">Events</a></li>
-					<li><a href="/news">News</a></li>
-					<li><a href="/about">About</a></li>
+					<li><a href="http://dpdk.org/">Home</a></li>
+					<li><a href="http://dpdk.org/download">Download</a></li>
+					<li><a href="http://dpdk.org/doc">Documentation</a></li>
+					<li><a href="http://dpdk.org/dev">Development</a></li>
+					<li><a href="http://dpdk.org/ml">Mailing Lists</a></li>
+					<li><a href="http://dpdk.org/events">Events</a></li>
+					<li><a href="http://dpdk.org/news">News</a></li>
+					<li><a href="http://dpdk.org/about">About</a></li>
 				</ul>
 			</nav>
 		</header>
 		<section>
-			<h2>404: page not found</h2>
+			<h2>403: forbidden</h2>
 			<p>This URL is not valid, sorry !</p>
 		</section>
 	</body>
diff --git a/404.html b/404.html
index c5f2384..d671e1e 100644
--- a/404.html
+++ b/404.html
@@ -4,9 +4,9 @@
 		<meta charset="utf-8" />
 		<meta name=viewport content="width=device-width, initial-scale=1" />
 		<title>DPDK 404</title>
-		<link rel="stylesheet" href="/reset.css" />
-		<link rel="stylesheet" href="/layout.css" />
-		<link rel="stylesheet" href="/content.css" />
+		<link rel="stylesheet" href="http://dpdk.org/reset.css" />
+		<link rel="stylesheet" href="http://dpdk.org/layout.css" />
+		<link rel="stylesheet" href="http://dpdk.org/content.css" />
 		<script type="text/javascript">
 			var _gaq = _gaq || [];
 			_gaq.push(['_setAccount', 'UA-39229303-1']);
@@ -22,17 +22,18 @@
 	</head>
 	<body>
 		<header>
-			<h1><a href="http://dpdk.org/"><img src="/dpdk.png" alt="DPDK: Data Plane Development Kit"></a></h1>
+			<h1><a href="http://dpdk.org/"><img src="http://dpdk.org/dpdk.png"
+					alt="DPDK: Data Plane Development Kit"></a></h1>
 			<nav>
 				<ul>
-					<li><a href="/">Home</a></li>
-					<li><a href="/download">Download</a></li>
-					<li><a href="/doc">Documentation</a></li>
-					<li><a href="/dev">Development</a></li>
-					<li><a href="/ml">Mailing Lists</a></li>
-					<li><a href="/events">Events</a></li>
-					<li><a href="/news">News</a></li>
-					<li><a href="/about">About</a></li>
+					<li><a href="http://dpdk.org/">Home</a></li>
+					<li><a href="http://dpdk.org/download">Download</a></li>
+					<li><a href="http://dpdk.org/doc">Documentation</a></li>
+					<li><a href="http://dpdk.org/dev">Development</a></li>
+					<li><a href="http://dpdk.org/ml">Mailing Lists</a></li>
+					<li><a href="http://dpdk.org/events">Events</a></li>
+					<li><a href="http://dpdk.org/news">News</a></li>
+					<li><a href="http://dpdk.org/about">About</a></li>
 				</ul>
 			</nav>
 		</header>
diff --git a/layout.css b/layout.css
index 9b06455..787e981 100644
--- a/layout.css
+++ b/layout.css
@@ -1,4 +1,4 @@
- at import url(/fonts.css);
+ at import url(http://dpdk.org/fonts.css);
 
 html {
 	margin: 0 1em;
diff --git a/scripts/serve_local.py b/scripts/serve_local.py
index a18659f..63a0e59 100644
--- a/scripts/serve_local.py
+++ b/scripts/serve_local.py
@@ -37,7 +37,7 @@ class DPDK_Handler(BaseHTTPServer.BaseHTTPRequestHandler):
             self.send_response(200)
             self.send_header('Content-type', mimetype)
             self.end_headers()
-            self.wfile.write(f.read())
+            self.wfile.write(f.read().replace('http://dpdk.org', ''))
             f.close()
         except IOError:
             self.send_error(404, 'File Not Found: %s' % path)
-- 
2.7.0



More information about the web mailing list