Re: [pylons-discuss] request.resource_url or request.resource_path

2024-05-29 Thread Mike Orr
The '*_path' methods also make the generated HTML easier to read,
because they're shorter and focus on the changing part.

On Wed, May 29, 2024 at 8:03 AM Mike Orr  wrote:
>
> I prefer the '*_path' methods to get relative URLs that automatically
> adjust to more environments, and to minimize the chance of mismatches
> behind reverse proxies. Except in redirects where I've read the target
> is supposed to be an absolute URL. Some other Pyramid developers
> prefer the '*_url' methods.
>
> On Tue, May 28, 2024 at 11:32 PM Petr Blahoš  wrote:
> >
> > Hi,
> > I have been using pyramid for many years and I have always been
> > using
> >
> > request.resource_url
> > request.static_url
> > or similar ending with _url.
> >
> > Yesterday when trying to make IIS work as a reverse proxy I noticed
> > that the links in my pages contain scheme://hostname:port part of the
> > URL too. So I am thinking: Should I always use the resource_path / 
> > static_path
> > functions to make the URLs?
> >
> > What are your thoughts?
> > Thanks,
> > Petr
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "pylons-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to [email protected].
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/pylons-discuss/CA%2ByMeXVZ%3DxN6yYCC-oRU3W%3D7J52xzAuQfVwJSyyKep4gpg%3Do5Q%40mail.gmail.com.
>
>
>
> --
> Mike Orr 



-- 
Mike Orr 

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3DuoRSOQwPG9w0-MZy6dLuHZBWmcq_2WKMmk7xobdfYgBOA%40mail.gmail.com.


Re: [pylons-discuss] request.resource_url or request.resource_path

2024-05-29 Thread Michael Merickel
It really doesn’t make a difference imo. If you are using path to get around a 
proxy misconfig in your WSGI env then stop and go fix the misconfig because as 
Mike said, certain things like a Location header in a redirect are required to 
be absolute and will be incorrectly computed if your env’s http scheme, host, 
and script_name aren’t right. 

- Michael

> On May 29, 2024, at 09:04, Mike Orr  wrote:
> 
> I prefer the '*_path' methods to get relative URLs that automatically
> adjust to more environments, and to minimize the chance of mismatches
> behind reverse proxies. Except in redirects where I've read the target
> is supposed to be an absolute URL. Some other Pyramid developers
> prefer the '*_url' methods.
> 
>> On Tue, May 28, 2024 at 11:32 PM Petr Blahoš  wrote:
>> 
>> Hi,
>> I have been using pyramid for many years and I have always been
>> using
>> 
>> request.resource_url
>> request.static_url
>> or similar ending with _url.
>> 
>> Yesterday when trying to make IIS work as a reverse proxy I noticed
>> that the links in my pages contain scheme://hostname:port part of the
>> URL too. So I am thinking: Should I always use the resource_path / 
>> static_path
>> functions to make the URLs?
>> 
>> What are your thoughts?
>> Thanks,
>> Petr
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "pylons-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pylons-discuss/CA%2ByMeXVZ%3DxN6yYCC-oRU3W%3D7J52xzAuQfVwJSyyKep4gpg%3Do5Q%40mail.gmail.com.
> 
> 
> 
> --
> Mike Orr 
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3Duqh7TCu2e5Upy2hSt7gh8BxxMdv8b6gRqwVeYoZEnF11Q%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/565FE6B2-EDE7-4B29-AEBB-7FD332629E57%40gmail.com.


Re: [pylons-discuss] request.resource_url or request.resource_path

2024-05-29 Thread Mike Orr
I prefer the '*_path' methods to get relative URLs that automatically
adjust to more environments, and to minimize the chance of mismatches
behind reverse proxies. Except in redirects where I've read the target
is supposed to be an absolute URL. Some other Pyramid developers
prefer the '*_url' methods.

On Tue, May 28, 2024 at 11:32 PM Petr Blahoš  wrote:
>
> Hi,
> I have been using pyramid for many years and I have always been
> using
>
> request.resource_url
> request.static_url
> or similar ending with _url.
>
> Yesterday when trying to make IIS work as a reverse proxy I noticed
> that the links in my pages contain scheme://hostname:port part of the
> URL too. So I am thinking: Should I always use the resource_path / static_path
> functions to make the URLs?
>
> What are your thoughts?
> Thanks,
> Petr
>
> --
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pylons-discuss/CA%2ByMeXVZ%3DxN6yYCC-oRU3W%3D7J52xzAuQfVwJSyyKep4gpg%3Do5Q%40mail.gmail.com.



-- 
Mike Orr 

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3Duqh7TCu2e5Upy2hSt7gh8BxxMdv8b6gRqwVeYoZEnF11Q%40mail.gmail.com.