H! El lun., 11 nov. 2019 a las 17:03, Dave S (<snidely....@gmail.com>) escribió:
> > > On Monday, November 11, 2019 at 7:12:44 AM UTC-8, Yoel Benitez Fonseca > wrote: >> >> h! >> >> Is it possible to change the hostname that comes in the form request so >> that outbound links have the hostname i want? >> > > I think you want to look at routes.py, but I haven't tried this use case, > so any details I could give you are in the book. > No, I know what my mistake is, some of the links are generated by *URL*, using the *host* and *scheme* parameters. In case it serves anyone else, all this is deploying the app as a lambda funsion on AWS with zappa with an NGINX in front as a proxy. I guess I will have to hard code the host directly in the code. > > >> >> I have an app in an internal network that I want to make visible from the >> outside with an nginx proxy, all relative links work correctly, this would >> be the example of configuration in nginx: >> >> location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ { >> rewrite ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ >> /some-folder/statics/staging/$2 break; >> proxy_ignore_headers Cache-Control; >> add_header Cache-Control public; >> add_header Cache-Control max-age=31536000; # seconds, one year >> proxy_pass_request_headers on; >> proxy_pass https://some.internal.server.local; >> } >> >> location ~* ^/(.*)$ { >> rewrite ^/(.*)$ /staging/$1 break; >> proxy_set_header Host "some.internal.server.local"; >> proxy_set_header X-Real-IP $remote_addr; >> proxy_ssl_server_name on; >> proxy_pass https://some.internal.server.local; >> } >> >> >> That works correctly for any relative link, the problem comes with >> uploads, whose links are being generated for some reason including the >> hostname: >> >> https://some.internal.server.local >> /app/download/some.object.a051462ffdcb77a3.746d706c32417038422e6a7067.jpg >> >> and how it happens, i can't change the internal server name and need to >> pass the proxy_set_header Host or I will not have access to that host... The >> only thing I can think of is telling WEB2PY to use a fixed host name when >> generating the links. >> >> > /dps > > > > > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/c747477d-0665-45ba-92f5-e2a87e2d1fca%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/c747477d-0665-45ba-92f5-e2a87e2d1fca%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Msc. Yoel BenÃtez Fonseca -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CAFDb1rVwfPpsSoAzyymWZdJG%2Bo6pOg9zP9ukNFkMJcZ%3DquzReA%40mail.gmail.com.