-
Notifications
You must be signed in to change notification settings - Fork 131
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
Patch URL helper to assume use_appname=False if the host is a FQDN #918
Conversation
…ualified Domain Name
It seems to me we already have a mechanism to not inject appname if HTTP_X_PY4WEB_APPNAME is present. So all we need to do in nginx is
(details depend on the nginx version) |
Hmm... there is a problem with this solution. I just tested, to be sure, but:
However... if one would be to use
|
Investigating a bit further, I seem to be running into some issues, though... Will report as soon as I get to the bottom of. It appears as if adding this |
Right... so the problem is indeed in Ombott implementation - concretly in
For our example data:
The problem is that: |
ouch! Good find. will you be creating an Ombott ticket?
…On Thu, Sep 5, 2024, 08:36 Krzysztof Socha ***@***.***> wrote:
Right... so the problem is indeed in Ombott implementation - concretly in
request_pkg/props_mixin.py. This is the function that calculates the
request.fullpath:
def fullpath(self):
""" Request path including :attr:`script_name` (if present). """
appname = self._env_get(self.config.app_name_header, '/')
return urljoin(self.script_name, self.path[len(appname):].lstrip('/'))
For our example data:
path = '/app1/config/test'
appname = 'app1'
The problem is that: path[len(appname):].lstrip('/') evaluates to
1/config/test. 😔
—
Reply to this email directly, view it on GitHub
<#918 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHLZTY2WWJOXYWVTI6KRN3ZVB3APAVCNFSM6AAAAABNU7GJCGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSGA2DSMRRGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yes - already have - valq7711/ombott#18 |
We may need to change some of the URL generations in Auth to actually use URL if not using it already. |
So... After some more testing and discussing in valq7711/ombott#18 - it seems that actually everything is already fine 😂
I actually managed to get the logical/expected behaviour with current master of Ombott and py4web. The thing is that Form, Grid, and Auth only use the elements from Ombott's
Sorry for bothering everybody ;) I now believe that the only changes required are to the py4web documentation to spell it out. I can propose the text Massimo, if you agree, but let me know where this should be placed. I think something like Deployment Recepies chapter would be a good idea. |
I created a PR #921 for the documentation. I think this is sufficient to close this PR. |
So - following the discussion in #911 - here is an idea for fixing the URL helper to automagically choose the value of the
use_appname
parameter.Basically, I added one condition to check if there is a valid host being passed to the app. If the host (which I get from
request.urlparts[1]
) is a valid FQDN (i.e., a Fully Qualified Domain Name), the assumption is thatappname
should not be used in constructing the URL, and henceuse_appname
is set toFalse
.There is of course the related import and updated
requirements.txt
.