Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Introduce new attributes to enable the use behind a proxy #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkobel
Copy link
Contributor

@mkobel mkobel commented Jul 26, 2015

  • prd_web_ui_base_url : The public URL for flapjack
  • prd_json_api_url : The public URL for the flapjack-api

This enables us to run flapjack on https://servername/flapjack/ with the following config:

flapjack

prd_json_api_url => 'https://monitoring/flapjack/api/',
prd_web_ui_base_url => 'https://monitoring/flapjack/',

apache

ProxyHTMLURLMap http://127.0.0.1:3080/ /flapjack/
ProxyHTMLExtended On
ProxyPass /flapjack/api/ http://127.0.0.1:3081/
ProxyPassReverse /flapjack/api/ http://127.0.0.1:3081/
ProxyPass /flapjack/ http://127.0.0.1:3080/
ProxyPassReverse /flapjack/ http://127.0.0.1:3080/

* prd_web_ui_base_url  : The public URL for flapjack
* prd_json_api_url : The public URL for the flapjack-api

## JSON API Params
$prd_json_api_access_log = 'jsonapi_access.log',
$prd_json_api_base_url = 'http://localhost',
$prd_json_api_url = undef,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think $prd_json_api_base_url and $prd_json_api_url should always be the same if specified? So the new variable is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my point of view, the $prd_json_api_base_url is the internal url (behind a proxy). The $prd_json_api_url is the public url in front of the proxy.
Internal we run the flapjack-api on http://localhost:3081/ and external on https://hostname/flapjack/api/ (where apache is the proxy wo cares about the authentication)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that they're both used in the source code for values that will be used externally -- in pages or Location HTTP headers as appropriate. (Unless the proxy is doing some sort of translation I guess? I'd have to review things in that case.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think abount a config like this:

Flapjack:

   web:
      port: 3080
      base_url: 'http://localhost:3080/'

Apache:

ProxyPass /flapjack/ http://localhost:3080/
ProxyPassReverse /flapjack/ http://localhost:3080/

This results in http://localhost:3080/ URLs in the content of https://hostname/flapjack/ on our setup using Apache 2.2. on Debian Linux.

The only "workaround" I found was changing the base_url. Which should be independent of the port.

@jessereynolds
Copy link
Member

It might work better to merge in #11 and then look at if this one will merge cleanly, and whether any other pertinent issues from the above discussion still remain.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants