Nginx proxy config in a folder #152
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
KittenSquad/glewlwyd#152
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'd like to use this app on a shared subdomain with other apps, each residing in a folder that Nginx proxies to based on the directory in the URL.
I've tried the following:
Nginx config:
Glewlwyd.conf:
webapp/config.json:
I would think this would be pretty transparent to Glewlwyd, since Nginx is rewriting the URLs as they come through. With this I can log in, log out, and get pages to load but callback redirects don't work. I get a 400 error about scope with the following:
Is there something else I need to do, or a better way, to accomplish Nginx as a reverse proxy aimed at Glewlwyd in a subfolder?
In the endpoint
GET/auth/scheme, the API returns an error 400 if the scope parameter is empty. My intuition is that your nginx proxy configuration doesn't pass the query parameters to Glewlwyd.That was my suspicion as well. I found the other report awhile back about having to manually add the authorization header. Will work on the Nginx docs a bit and report back for others when I get it working, thanks!
Thanks!
If you're ok, open a pull request to update the new section
Reverse proxy configurationin the Install documentation with a new paragraph for Nginx proxy configuration.Will do!
The answer to this is that there is no answer with
locationregex trickery, because Nginx will only pass URL queries and params if you modify the URL viarewrite, so here's a working config for Nginx in a subfolder:This will listen on the subdirectory https://site.url/authsrv but pass all requests to the backend at the root URL the backend expects. Only the webapp config needs to be changed to reflect the /authsrv directory for redirect purposes.
I'll submit a docs PR later with examples for both a root URL with Nginx and a subdirectory with Nginx.
Nice!
Why must the header
Authorizationbe specifically passed in the proxy config? I assume all the other headers are forwarded. Is there an exception for theAuthorizationheader?I also assume this config goes for https reverse proxy as well?
Also, I write it down here to not forget about it, but I'd like to add the client ssl certificate proxy config in the documentation. For what I've seen, I have to add the following settings:
Yes, I tried to disable the certificate settings in the glewdwyd.conf but that got me an error, if I remember correctly, so it seems that one cannot comment them out even if SSL is disabled?
Because Nginx ignores any headers not present in the initial request of a session. I presume that in the glewlwyd web app an unauthorized user has no Authentication header until they log in, so Nginx will not pass it in subsequent requests unless it is explicitly declared for the first request.
It should, but anyone wanting to pass SSL through Nginx as a proxy should not be bothering with certificates at the proxy, when they can use
ssl_preread(optional module under the "stream" set of Nginx addons) that allows Nginx to sniff out the address, but send the encrypted packets on through unmodified. By doing that, an SSL pass-through proxy with Nginx is very simple, just a qualified domain to listen on and a host map that the domain proxies to with whatever load balancing rules, if any.Here's a whole Nginx config for multiple domains with load balancing (I have multiple OS virtual machines to test Ansible deployment scripts on, so I load balance them on a single domain, domain1, based on which one is booted up at any given time) running on my home consumer-grade router with ~256mb of RAM and an ARM cpu. No includes, no certificates, just
ssl_preread.Not really stateless but ok
Well, technically, Glewlwyd's webapp uses session cookies to authenticate users. The
Authorizationheader is used in the oidc and oauth2 plugins.I'm not sure we're talking about the same thing, I was talking about having a Nginx as a reverse proxy, listening on
https://and forwarding to a glewlwyd onhttp://.Thanks for the pull request! I think this bug can be closed now, don't you?
Yes, this is all working fine for me. I'll post back in this thread about what I find with the
Authorizationheader. I found your project after failing to get Keycloak to work for a couple of days with an API backend that I am trying to evaluate, which simply would not authenticate properly no matter what I tried (using openid).Yours is much lighter which is also a plus for a small server without much RAM, but after setting up both I wonder if Nginx not passing
Authorizationwith proxy requests was the issue all along. I'm going by the report in #32 about the need to add it.