OLD | NEW |
1 # This file is part of the Juju GUI, which lets users view and manage Juju | 1 # This file is part of the Juju GUI, which lets users view and manage Juju |
2 # environments within a graphical interface (https://launchpad.net/juju-gui). | 2 # environments within a graphical interface (https://launchpad.net/juju-gui). |
3 # Copyright (C) 2013 Canonical Ltd. | 3 # Copyright (C) 2013 Canonical Ltd. |
4 # | 4 # |
5 # This program is free software: you can redistribute it and/or modify it under | 5 # This program is free software: you can redistribute it and/or modify it under |
6 # the terms of the GNU Affero General Public License version 3, as published by | 6 # the terms of the GNU Affero General Public License version 3, as published by |
7 # the Free Software Foundation. | 7 # the Free Software Foundation. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | 10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 websocket_handler_options = { | 49 websocket_handler_options = { |
50 # The Juju API backend url. | 50 # The Juju API backend url. |
51 'apiurl': options.apiurl, | 51 'apiurl': options.apiurl, |
52 # The backend to use for user authentication. | 52 # The backend to use for user authentication. |
53 'auth_backend': auth.get_backend(options.apiversion), | 53 'auth_backend': auth.get_backend(options.apiversion), |
54 # The Juju deployer to use for importing bundles. | 54 # The Juju deployer to use for importing bundles. |
55 'deployer': deployer, | 55 'deployer': deployer, |
56 # The tokens collection for authentication token requests. | 56 # The tokens collection for authentication token requests. |
57 'tokens': tokens, | 57 'tokens': tokens, |
58 } | 58 } |
| 59 juju_proxy_handler_options = { |
| 60 'target_url': utils.ws_to_http(options.apiurl), |
| 61 'charmworld_url': options.charmworldurl, |
| 62 } |
59 server_handlers.extend([ | 63 server_handlers.extend([ |
60 # Handle WebSocket connections. | 64 # Handle WebSocket connections. |
61 (r'^/ws$', handlers.WebSocketHandler, websocket_handler_options), | 65 (r'^/ws$', handlers.WebSocketHandler, websocket_handler_options), |
62 # Handle connections to the juju-core HTTPS server. | 66 # Handle connections to the juju-core HTTPS server. |
63 # The juju-core HTTPS and WebSocket servers share the same URL. | 67 # The juju-core HTTPS and WebSocket servers share the same URL. |
64 (r'^/juju-core/(.*)', handlers.ProxyHandler, | 68 (r'^/juju-core/(.*)', handlers.JujuProxyHandler, |
65 {'target_url': utils.ws_to_http(options.apiurl)}), | 69 juju_proxy_handler_options), |
66 ]) | 70 ]) |
67 if options.testsroot: | 71 if options.testsroot: |
68 params = {'path': options.testsroot, 'default_filename': 'index.html'} | 72 params = {'path': options.testsroot, 'default_filename': 'index.html'} |
69 server_handlers.append( | 73 server_handlers.append( |
70 # Serve the Juju GUI tests. | 74 # Serve the Juju GUI tests. |
71 (r'^/test/(.*)', web.StaticFileHandler, params), | 75 (r'^/test/(.*)', web.StaticFileHandler, params), |
72 ) | 76 ) |
73 info_handler_options = { | 77 info_handler_options = { |
74 'apiurl': options.apiurl, | 78 'apiurl': options.apiurl, |
75 'apiversion': options.apiversion, | 79 'apiversion': options.apiversion, |
(...skipping 15 matching lines...) Expand all Loading... |
91 | 95 |
92 def redirector(): | 96 def redirector(): |
93 """Return the redirector application. | 97 """Return the redirector application. |
94 | 98 |
95 The redirector app is responsible for redirecting HTTP traffic to HTTPS. | 99 The redirector app is responsible for redirecting HTTP traffic to HTTPS. |
96 """ | 100 """ |
97 return web.Application([ | 101 return web.Application([ |
98 # Redirect all HTTP traffic to HTTPS. | 102 # Redirect all HTTP traffic to HTTPS. |
99 (r'.*', handlers.HttpsRedirectHandler), | 103 (r'.*', handlers.HttpsRedirectHandler), |
100 ], debug=options.debug) | 104 ], debug=options.debug) |
OLD | NEW |