Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Terminated Environment #384

Closed
philipbjorge opened this issue Oct 9, 2016 · 5 comments
Closed

SSL Terminated Environment #384

philipbjorge opened this issue Oct 9, 2016 · 5 comments
Labels

Comments

@philipbjorge
Copy link
Contributor

Hi,
We're running hug in behind a load balancer that terminates SSL.
That is causing our documentation to generate examples that are http://host_name/...

Could you point me in the right direction to how I would configure a protocol or entire base url manually?

@philipbjorge
Copy link
Contributor Author

One way to do this is the following...

@hug.not_found()
def handle_404(request, hug_api):
    http = hug_api.http
    return http.documentation("https://custom-base-url.com", http.determine_version(request, False))

@philipbjorge
Copy link
Contributor Author

This now needs to be changed to...
return http.documentation(api_version=http.determine_version(request, False), prefix=config.API_BASE_URL)

After this change -- af23bd5

@briceparent
Copy link

Hi!
I'm having the same question, I think. I'm not running a load balancer, but I have nginx with SSL encryption, so my users need to access my API using https, but my documentation shows examples with http (which is prohibited, only https is authorized).

The problem is not to redirect incoming http connections to https, but just to have the documentation display examples with https. (or even better, to use the same protocol as I'm using to display the documentation page, so that the links are still correct on my development station, with http).

If I misunderstood the original question and should post this in a new issue, please tell me!

Brice

@briceparent
Copy link

In fact, it gives me links like this:
http://mydomain.com:443/hello
which to my knowledge doesn't make much sense... and when following it, Nginx returns a 400 error saying "The plain HTTP request was sent to HTTPS port".

@tuffnatty
Copy link
Contributor

Pull request: #708

timothycrosley added a commit that referenced this issue Feb 16, 2019
Fixed #384: wrong scheme in example endpoints when proxied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants