-
Notifications
You must be signed in to change notification settings - Fork 296
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
server_url() broken in Docker image #879
Comments
Thanks for the report! The server name should be set in the Docker container. @virtualtam do you want to take a look at it? |
Though an environment variable? I can do that myself if it's what's wanted, sounded a bit hacky though. |
Hi! Thanks @smuth4 for the feedback, there hasn't been much regarding our Docker images (either they work really well, or very few people use them ^^) There is a full rewrite using an Alpine Linux base under work at #843 & #846 , I'm currently looking for a sane way to automate unit testing Shaarli in a containerized environment. Nginx's
This setting cannot be changed at runtime, and cannot be parameterized using an environment variable: As
Relevant documentation:
|
This would not have been caught in the unit tests as they are now.
You could have the startup script run a quick sed on the config. Hacky, like I said, and something I'd only do as a last resort. How would you like me to proceed? I can fall back to |
@smuth4 Let's start with fixing support for proxy-forwarded host settings; as I'd rather avoid adding complexity to Dockerfiles and startup scripts. @ArthurHoaro Regarding spoofing: though it's not mentioned in our Docker usage docs (for now), containers should run and be served/routed behind a reverse proxy to ensure:
|
Yes that's what I'm doing, even though I'm not using the official image (I add theme, plugins, and stuff), but I don't see any relation with spoofing. What I was saying is that, if I'm not mistaken, |
By default nginx actually set this to proxy_host instead: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header, and HTTP_X_FORWARDED_HOST can be set by the user just like HTTP_HOST if nothing is reversing proxying (not saying HTTP_HOST is the better option, just pointing out behavior). @virtualtam I'm willing to help if need be, but I'm not sure what, if anything, I should be doing in regards to "fixing support for proxy-forwarded host settings". |
alongside PROTO and PORT Fixes shaarli#879
alongside _PORT and _PROTO Fixes shaarli#879
Is there any issue preventing you to add |
No real issue except that I don't know yet how to do it. However, it seems to me that supporting |
I fixed my reverse proxy issue by adding to the nginx configuration:
I use jwilder/nginx-proxy, a very popular reverse proxy for Docker. Because it is widely used, I think it would be an improvement that the shaarli image worked out of the box with it. The only needed change would be to make |
@nbud I've raised #1010 to provide a working example + documentation for Compose + Nginx reverse proxy I suspect most remaining issues are related to the involved proxies' configuration (esp. headers) rather than the code dealing with HTTP headers; feel free to open new issues though, should you see any specific point to be addressed ;-) |
Features that use the
server_url
function break inside the official docker container (I'm running development), due to$_SERVER['SERVER_NAME']
defaulting to""
since none is defined in nginx.conf. I think that falling back toHTTP_HOST
ifSERVER_NAME
isn't set is a good compromise, but wanted to check before starting on any workThe text was updated successfully, but these errors were encountered: