Commit 289c7283 by source_reader

added flag to control app subdomain option

parent 0a2e0eaf
Showing with 3 additions and 5 deletions
...@@ -19,16 +19,14 @@ class DataAppController < ApplicationController ...@@ -19,16 +19,14 @@ class DataAppController < ApplicationController
def _app_auth_url def _app_auth_url
# apps require a proxy server (like nginx) # apps require a proxy server (like nginx)
return nil unless ( return nil unless
request.headers.key?("HTTP_X_APP_BASE_URI") or request.headers.key?("HTTP_X_SUBDOMAIN_APPS")
request.headers.key?("HTTP_X_APP_SERVER_NAME"))
# try to use the server name header, otherwise try the base_uri
token = InterfaceAuthToken.create(data_app: @app, token = InterfaceAuthToken.create(data_app: @app,
user: current_user, user: current_user,
expiration: 5.minutes.from_now) expiration: 5.minutes.from_now)
# proxy supports subdomains (preferred because more secure and flexible) # proxy supports subdomains (preferred because more secure and flexible)
if request.headers.key?("HTTP_X_APP_SERVER_NAME") if request.headers["HTTP_X_SUBDOMAIN_APPS"] == 'true'
server = request.headers["HTTP_X_APP_SERVER_NAME"] server = request.headers["HTTP_X_APP_SERVER_NAME"]
scheme = request.headers["HTTP_X_APP_SERVER_SCHEME"] scheme = request.headers["HTTP_X_APP_SERVER_SCHEME"]
"#{scheme}://#{token.data_app.id}.app.#{server}?auth_token=#{token.value}" "#{scheme}://#{token.data_app.id}.app.#{server}?auth_token=#{token.value}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment