@@ -252,6 +252,8 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager,
252
252
password = jupyter_app .password ,
253
253
xsrf_cookies = True ,
254
254
disable_check_xsrf = jupyter_app .disable_check_xsrf ,
255
+ allow_remote_access = jupyter_app .allow_remote_access ,
256
+ local_hostnames = jupyter_app .local_hostnames ,
255
257
256
258
# managers
257
259
kernel_manager = kernel_manager ,
@@ -831,6 +833,29 @@ def _token_changed(self, change):
831
833
"""
832
834
)
833
835
836
+ allow_remote_access = Bool (False , config = True ,
837
+ help = """Allow requests where the Host header doesn't point to a local server
838
+
839
+ By default, requests get a 403 forbidden response if the 'Host' header
840
+ shows that the browser thinks it's on a non-local domain.
841
+ Setting this option to True disables this check.
842
+
843
+ This protects against 'DNS rebinding' attacks, where a remote web server
844
+ serves you a page and then changes its DNS to send later requests to a
845
+ local IP, bypassing same-origin checks.
846
+
847
+ Local IP addresses (such as 127.0.0.1 and ::1) are allowed as local,
848
+ along with hostnames configured in local_hostnames.
849
+ """ )
850
+
851
+ local_hostnames = List (Unicode (), ['localhost' ], config = True ,
852
+ help = """Hostnames to allow as local when allow_remote_access is False.
853
+
854
+ Local IP addresses (such as 127.0.0.1 and ::1) are automatically accepted
855
+ as local as well.
856
+ """
857
+ )
858
+
834
859
open_browser = Bool (True , config = True ,
835
860
help = """Whether to open in a browser after starting.
836
861
The specific browser used is platform dependent and
0 commit comments