-
Notifications
You must be signed in to change notification settings - Fork 7
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
Proto not set when running behind reverse proxy #27
Comments
Thanks for bringing this up! I think this would affect a use case that I'm working on myself so it's really useful :) While even I am currently only running galactory with the werkzeug server (on my workstation or in CI for example), production use should probably use a different WSGI server. In that case, I think it would be up to the implementer to use For the built-in server / CLI usage, adding Does that sound right to you? |
So I am looking into this some more. See the docs for The config value we'd set is I'm testing this out a bit now. |
...and I realize now that variable won't work, it's only used when there is no request context (just like it says in the docs), so it can't be implicit. I've implemented it explicitly in testing though; it also surfaced another problem which is setting |
@jcox10 would you be able to try the changes in PR #29 ? You can pull/checkout my branch, or if it's easier to use
I've added btw you may also be interested in the change I added in #28 , in case you were wanting to use a WSGI server like gunicorn or waitress or something; that change should make it easier to do so while using the existing configuration system. That might be an opportunity for you to inject |
Thanks! I'll try it out when I am back at work on Monday.
…On Wed, Dec 14, 2022 at 11:48 AM Brian Scholer ***@***.***> wrote:
@jcox10 <https://github.com/jcox10> I've merged your changes in #26
<#26> 🎉 and I've rebased #29
<#29> to include those changes
—
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGCCVQG3CAL77M7DXX4IY7LWNII6LANCNFSM6AAAAAAS5N5IEE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It looks like the flask auto-redirect to trailing slash doesn't have the correct scheme. The first thing ansible-galaxy does is tries to access curl https://my-server-name.com:8888/api
<!doctype html>
<html lang=en>
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to the target URL: <a href="http://my-server-name.com:8888/api/">http://my-server-name:8888/api/</a>. If not, click the link. I'm not sure how to configure flask for what scheme it should use for these auto-redirects. |
However maybe I specified my |
Thanks @jcox10 this is good information, I'm going to look into it some more and see what else can be done. When you use the server option that doesn't result in any redirects, is it otherwise working well to address the original issue? |
@jcox10 all of the other endpoints in the project define the route twice (once with and one without the trailing Do you have any outstanding concerns or issues about #29? |
It works good, I've been running it for a few days now! Good find on the missing blank route! |
In our environment, we run most everything behind a NGINX reverse proxy that handles all the SSL termination (we are required to have everything HTTPS). Most everything works properly, except when the
flask.url_for
generates an external URL, it defaults to standard HTTP. I found this ProxyFix page that has a solution and I tested it with settingapp.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)
in the main__init__.py
.However I'm not sure if that is the best option, or if it would be better to add a arg similar to the
SERVER_NAME
that would beSERVER_PROTO
as seen from the client? Then pass that in when generating theurl_for
?The text was updated successfully, but these errors were encountered: