Skip to content
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

Reverse Proxy and folder #1778

Open
ben-64 opened this issue Jul 31, 2021 · 2 comments
Open

Reverse Proxy and folder #1778

ben-64 opened this issue Jul 31, 2021 · 2 comments
Assignees
Labels
docker containers & cloud proxy hosting behind reverse proxies server
Milestone

Comments

@ben-64
Copy link

ben-64 commented Jul 31, 2021

Hello,

I would like to run shaarli behind a reverse proxy (I am using the Shaarli docker image). My reverse proxy configuration is the following:

server {
        listen 443 ssl;
...
        location /folder/ {
                proxy_set_header  X-Real-IP         $remote_addr;
                proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
                proxy_set_header  X-Forwarded-Proto $scheme;
                proxy_set_header  X-Forwarded-Host  $host;

                # pass requests to the proxied host
                proxy_pass http://shaarli/;
                proxy_set_header Host  $host;
                proxy_connect_timeout  30s;
                proxy_read_timeout     120s;
        }

So a very basic configuration I would say.
Due to the fact that shaarli is requested on /, it generates URL without the folder part for web browser. Therefore they are requesting files without this folder, and of course it fails.

According to that issue, it is a normal behaviour. It would be very easy to bypass this limitation with this pull request. I am using it since multiple weeks and it works perfectly.

What is the correct configuration to use at nginx level or shaarli level to run behind a reverse proxy ?

Thank you in advance,

@ArthurHoaro
Copy link
Member

Hi, thank you for your detailed report.

I booted up a quick EC2 instance and was able to reproduce your issue. I tried to play with nginx config and proxy headers but @virtualtam was right in the issue you linked and there is no easy way to pass the proxy location into the container's request path without changing the configuration inside our Docker image.

I will take some time to have a more in-depth look at your previous PR and find a solution to handle this at the project's configuration level without introducing breaking changes to other configurations.

@ArthurHoaro ArthurHoaro self-assigned this Aug 14, 2021
@ArthurHoaro ArthurHoaro added docker containers & cloud server labels Aug 14, 2021
@ArthurHoaro ArthurHoaro added this to the 1.0.0 milestone Aug 14, 2021
@virtualtam virtualtam added the proxy hosting behind reverse proxies label Aug 14, 2021
@miltosc
Copy link

miltosc commented Nov 2, 2021

Hello, wish for that feature too. Hope you will manage make it work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker containers & cloud proxy hosting behind reverse proxies server
Projects
None yet
Development

No branches or pull requests

4 participants