AndrewPaglusch / FlashPaper

One-time encrypted password/secret sharing
MIT License
392 stars 62 forks source link

Proper DNS name #60

Closed ben71fl closed 2 years ago

ben71fl commented 2 years ago

Hi sorry, if this has been answered, how can I set the valid URL that I want to return? Im running nginx with proxy outside the docker, and the site works just fine, but when the URL is generated its giving me an http://127.0.0.1:8080 (which is the nginx proxy listener). Is there a setting to put the URL I want in? I tested with full url=false which didnt seem to have any effect, and also tried setting some nginx settings like proxy host and such. Not sure if there is a setting to force set the URL or if this is an nginx proxy issue.

AndrewPaglusch commented 2 years ago

Thanks for reaching out, @ben71fl. Here is the function that builds the retreival URL. My goal with this function was to have FlashPaper "just work" without the administrator needing to hard-code a URL or directory, but sometimes that doesn't work out exactily how I had planned (like in your case).

Can you try setting the "Host" header in your Nginx proxy like this:

    location / {
        proxy_set_header Host $host;
        [...]
    }

I think adding a setting that overrides URL-building wouldn't be a bad idea for cases like this. This is something I will look into implementing.

ben71fl commented 2 years ago

I'm not sure if I needed all these, but this seemed to work for me in nginx, hopefully it helps others.

    location / {
            proxy_pass http://127.0.0.1:8080;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
AndrewPaglusch commented 2 years ago

I think the only required part is proxy_set_header Host $host;, but I'm glad this is working for you now. I will go ahead and close this. Please open it back up if you have any more questions or run into another related issue.