Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-8999

[fiware-stackoverflow] WireCloud and Horizon behind HTTPS proxy

    Details

      Description

      Created question in FIWARE Q/A platform on 11-05-2016 at 15:05
      Please, ANSWER this question AT https://stackoverflow.com/questions/37164185/wirecloud-and-horizon-behind-https-proxy

      Question:
      WireCloud and Horizon behind HTTPS proxy

      Description:
      We have a proxy running that serves HTTPS pages to the internet. Therefore it redirects requests into our DMZ where the pages are served as HTTP pages.

      We got WireCloud set up to run at a subdomain: wirecloud.example.com. Horizon runs at horizon.example.com.

      In Horizon the Callback URL is set to: http://wirecloud.example.com/complete/fiware/ and in the settings.py of Wirecloud the FIWARE_IDM_SERVER = 'http://horizon.example.com' is set.

      Now, when wirecloud.example.com/login gets called, it is redirected to https by our proxy and then redirected to horizon by wireclound what then gets redirected by our proxy to https://horizon.example.com/oauth2/authorize/?state=STATE_KEY&redirect_uri=http://wirecloud.example.com/complete/fiware/&response_type=code&client_id=CLIENT_ID. If the user is not logged in and now does so the redirect_uri gets transformed to this: http%253A%252F%252Fwirecloud.example.com%252Fcomplete%252Ffiware%252F what leads to this error:

      {"state": "STATE_KEY", "error": "invalid_redirect_uri"}

      (HTTP 400). If the user is already logged in and tries to authorize the app (WireCloud) a 405 error gets thrown:

      Environment:

      Request Method: GET
      Request URL: http://wirecloud.example.com/complete/fiware/?state=STATE_KEY&code=CODE

      Django Version: 1.9.6
      Python Version: 2.7.9
      Installed Applications:
      ('django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'django.contrib.admin',
      'wirecloud.commons',
      'compressor',
      'wirecloud.catalogue',
      'wirecloud.platform',
      'wirecloud.oauth2provider',
      'wirecloud.fiware',
      'social.apps.django_app.default')
      Installed Middleware:
      ('wirecloud.commons.middleware.URLMiddleware',)

      Traceback:

      File "/opt/wc/venv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
      149. response = self.process_exception_by_middleware(e, request)

      File "/opt/wc/venv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
      147. response = wrapped_callback(request, *callback_args, **callback_kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
      57. response = view_func(request, *args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
      58. return view_func(*args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/apps/django_app/utils.py" in wrapper
      51. return func(request, backend, *args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/apps/django_app/views.py" in complete
      28. redirect_name=REDIRECT_FIELD_NAME, *args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/actions.py" in do_complete
      43. user = backend.complete(user=user, *args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/backends/base.py" in complete
      41. return self.auth_complete(*args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/utils.py" in wrapper
      229. return func(*args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/backends/oauth.py" in auth_complete
      383. method=self.ACCESS_TOKEN_METHOD

      File "/opt/wc/venv/lib/python2.7/site-packages/social/backends/oauth.py" in request_access_token
      361. return self.get_json(*args, **kwargs)

      File "/opt/wc/venv/lib/python2.7/site-packages/social/backends/base.py" in get_json
      229. return self.request(url, *args, **kwargs).json()

      File "/opt/wc/venv/lib/python2.7/site-packages/social/backends/base.py" in request
      225. response.raise_for_status()

      File "/opt/wc/venv/lib/python2.7/site-packages/requests/models.py" in raise_for_status
      844. raise HTTPError(http_error_msg, response=self)

      Exception Type: HTTPError at /complete/fiware/
      Exception Value: 405 Client Error: METHOD NOT ALLOWED for url: https://horizon.example.com/oauth2/token

      So how do we need to configure WireCloud and/or Horizon and/or our proxy to get this to work?

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 15:14|CREATED monitor | # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 15:14|CREATED monitor | # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 18:10|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 18:10|UPDATED status: transition Answer| # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 21:10|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 21:10|UPDATED status: transition Finish| # answers= 1, accepted answer= True

          People

          • Assignee:
            backlogmanager Backlog Manager
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: