GithubHelp home page GithubHelp logo

Comments (3)

alcalyn avatar alcalyn commented on August 17, 2024

I found what is the error.

In Fider.settings.baseURL I have the wrong protocol, http instead of https (http://feedback.alcalyn.app/ instead of https://feedback.alcalyn.app/).

It leads to the following error:

DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'http://feedback.alcalyn.app/?view=recent' cannot be created in a document with origin

I installed Fider using Docker, and behind nginx with let's encrypt. When I check logs, docker receive requests without https:

INFO [2023-12-13T17:23:46Z] [WEB] GET http://feedback.alcalyn.app/ started
INFO [2023-12-13T17:23:46Z] [WEB] GET http://feedback.alcalyn.app/ finished with 200 in 130ms (committed)
INFO [2023-12-13T17:23:46Z] [WEB] GET http://feedback.alcalyn.app/_api/notifications/unread/total started
INFO [2023-12-13T17:23:46Z] [WEB] GET http://feedback.alcalyn.app/_api/notifications/unread/total finished with 200 in 25ms (committed)

I set the good BASE_URL in my docker-compose.yml:

  app:
    environment:
      # Public Host Name
      BASE_URL: https://feedback.alcalyn.app

and restarted it, still the error.

I checked the json inside document.getElementById("server-data") and the base url is without https.

The server is sending the wrong base url (assetsURL is well set):

  "settings": {
    "assetsURL": "https://feedback.alcalyn.app",
    "baseURL": "http://feedback.alcalyn.app",
     ...

I think the server is either sending this baseUrl from a cached variable (probably I missed the https and fixed it later), or is building the baseUrl from RequestContext, which is not possible when behind nginx, because it misses the https. The server should use either BASE_URL from env, or build it on front side from current url.

In the docker container, the env var is also well set:

root@19af12bc51c9:/app# echo $BASE_URL
https://feedback.alcalyn.app

I looked in the go code, but I'm not fluent with this language!

from fider.

alcalyn avatar alcalyn commented on August 17, 2024

I looked again this.
I could made it work by adding this in my nginx config:

server {
    listen 443;
    server_name feedback.alcalyn.app;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+       proxy_set_header X-Forwarded-Proto $scheme;

        proxy_pass http://0.0.0.0:....;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    ssl_certificate ...
    ssl_certificate_key ...
}

This way, fider app now have "https" in its web context.

Thanks to https://stackoverflow.com/questions/34656273/how-to-handle-nginx-reverse-proxy-https-to-http-scheme-redirect

from fider.

pierreavn avatar pierreavn commented on August 17, 2024

Hi, even if I force X-Forwarded-Proto header to.https, the search is still crashing, with http://mydomain.com as Take me back URL.
The X-Forwarded-Host header seems to work. Do you have any idea on it?

from fider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.