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

Hostpath includes protocol and is confuses http/https when behind a proxy #207

Closed
ctn opened this issue Jan 3, 2022 · 3 comments
Closed

Comments

@ctn
Copy link

ctn commented Jan 3, 2022

String hostpath = request.getAttribute("hostpath").toString();

I have nginx handle SSL and by the time it gets to this service, the request protocol is HTTP. When this hostpath is used to construct URLs, they come back to the client browser as HTTP instead of HTTPS.

A solution is simply to drop hostpath and use relative URIs.

Is there any other reason to use hostpath here?

If not, I have a simple PR that will fix this. Thanks.

@arnaudroques
Copy link
Contributor

If not, I have a simple PR that will fix this. Thanks.

You can go ahead, we will be glad to merge it.
Thanks!

@HeinrichAD
Copy link
Collaborator

Is there any other reason to use hostpath here?

hostpath does also include the context path of the URL.

// hostpath
return scheme + "://" + request.getServerName() + port + request.getContextPath();

So, the problem with your changes in PR #208 is, that it breaks the PlantUML Base URL path feature.

I think your problem should be solved if you add proxy_set_header X-Forwarded-Proto $scheme; inside your nginx configuration.

Maybe you will find one of the two examples helpful:

@ctn
Copy link
Author

ctn commented Jan 4, 2022

proxy_set_header X-Forwarded-Proto $scheme does indeed fix the scheme issue, and is a better solution. Thanks.

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

No branches or pull requests

3 participants