Repository: ipython/ipython

Issue:
nbconvert --to slides --post server reveal.js redirection not working
I am using ipython nbconvert to serve my notebooks as slides locally.

When I run ipython nbconvert --to slides --post serve my-notebook.ipynb the slides are not rendered correctly.

I have noticed in the log that a redirection is added to serve reveal.js:

`[NbConvertApp] Redirecting reveal.js requests to https://cdn.jsdelivr.net/reveal.js/2.5.0`

but https://cdn.jsdelivr.net/reveal.js/2.5.0 returns a 403 error. 

I have noticed that in the most recent version the file ipython/IPython/nbconvert/postprocessors/serve.py has the url updated to point to https://cdn.jsdelivr.net/reveal.js/2.6.2 -- this new url also returns a 403 error. 

---

Environment details:

python -c "import IPython; print(IPython.sys_info())"
{'commit_hash': '1c0eb68',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/Users/lm/anaconda/lib/python3.4/site-packages/IPython',
 'ipython_version': '2.3.1',
 'os_name': 'posix',
 'platform': 'Darwin-14.1.0-x86_64-i386-64bit',
 'sys_executable': '/Users/lm/anaconda/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.4.2 |Anaconda 2.1.0 (x86_64)| (default, Oct 21 2014, '
                '17:42:20) \n'
                '[GCC 4.2.1 (Apple Inc. build 5577)]'}



Discussion:
Can you test if 

~~ipython nbconvert your_slides.ipynb --to slides --post serve --reveal-prefix~~

is working for you? I am suspecting on a failure in the redirection...

EDIT: this is the correct command:

`ipython nbconvert your_slides.ipynb --to slides --post serve --ServePostProcessor.reveal_cdn="http://cdn.jsdelivr.net/reveal.js/2.5.0"`

(everything in one line).

ok... I think I know what the problem is... when we use `http://` the thing is working but not when you use the secured one, I mean `https://`...
@minrk @rgbkrk is there something we can do the the ServePostProcessor implementation to accept secure http?
As a quick workaround we can change the default url to `http` if necessary...
BTW, this probably need to be inside 3.0, if not the `--post serve` option is not working by default.

The command you suggested works for me.

This appears to be working for me with the https URL we use by default in master. Why would redirecting to an https URL be a problem?

This was not working the other day, let me check again... maybe a `jsdeliv` issue?

The situation is the same on my side.

OK, this is not working for me in master... I have this in the JS console:

```
 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://127.0.0.1:8000/reveal.js/css/reveal.css".
test_slides.slides.html:19 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://127.0.0.1:8000/reveal.js/css/theme/simple.css".
test_slides.slides.html:13675 Resource interpreted as Script but transferred with MIME type text/html: "http://127.0.0.1:8000/reveal.js/lib/js/head.min.js".
test_slides.slides.html:13677 Resource interpreted as Script but transferred with MIME type text/html: "http://127.0.0.1:8000/reveal.js/js/reveal.js".
test_slides.slides.html:13682 Uncaught ReferenceError: Reveal is not defined
test_slides.slides.html:13722 Uncaught ReferenceError: Reveal is not defined
```

The funny thing is that downgrading tornado to 3.2, I can get it working...

I know what the issue is, I'll have a PR with some fixes shortly. The proxy request is failing due to a missing package, and we are ignoring the error.


Resolving patch:
diff --git a/IPython/nbconvert/postprocessors/serve.py b/IPython/nbconvert/postprocessors/serve.py
--- a/IPython/nbconvert/postprocessors/serve.py
+++ b/IPython/nbconvert/postprocessors/serve.py
@@ -1,16 +1,9 @@
 """PostProcessor for serving reveal.js HTML slideshows."""
-from __future__ import print_function
-#-----------------------------------------------------------------------------
-#Copyright (c) 2013, the IPython Development Team.
-#
-#Distributed under the terms of the Modified BSD License.
-#
-#The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
 
-#-----------------------------------------------------------------------------
-# Imports
-#-----------------------------------------------------------------------------
+# Copyright (c) IPython Development Team.
+# Distributed under the terms of the Modified BSD License.
+
+from __future__ import print_function
 
 import os
 import webbrowser
@@ -22,9 +15,6 @@
 
 from .base import PostProcessorBase
 
-#-----------------------------------------------------------------------------
-# Classes
-#-----------------------------------------------------------------------------
 
 class ProxyHandler(web.RequestHandler):
     """handler the proxies requests from a local prefix to a CDN"""
@@ -37,12 +27,15 @@ def get(self, prefix, url):
     
     def finish_get(self, response):
         """finish the request"""
-        # copy potentially relevant headers
+        # rethrow errors
+        response.rethrow()
+        
         for header in ["Content-Type", "Cache-Control", "Date", "Last-Modified", "Expires"]:
             if header in response.headers:
                 self.set_header(header, response.headers[header])
         self.finish(response.body)
 
+
 class ServePostProcessor(PostProcessorBase):
     """Post processor designed to serve files
     


Test patch: