Giter VIP home page Giter VIP logo

Comments (5)

bugy avatar bugy commented on June 9, 2024

Hi @narenarora I'm not an nginx expert unfortunately :(
I tried to reproduce the issue, without Docker though, on script-server.net and everything worked fine for me.
I used 1.18 version build

This is my nginx config:

	location ^~ /test-nginx/ {
        proxy_pass_header Server;
        proxy_set_header Host $proxy_host;
        proxy_set_header X-Real-IP $remote_addr;
  #     proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:5000/;

        # needed for websockets
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Origin http://$proxy_host;
        }

from script-server.

bugy avatar bugy commented on June 9, 2024

I even tried it with docker:
sudo docker run -d -p 5001:5000 bugy/script-server:1.18.0

	location ^~ /test-nginx-docker/ {
        proxy_pass_header Server;
        proxy_set_header Host $proxy_host;
        proxy_set_header X-Real-IP $remote_addr;
  #     proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:5001/;

        # needed for websockets
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Origin http://$proxy_host;
        }

Still works fine :(

from script-server.

narenarora avatar narenarora commented on June 9, 2024

Thank you @bugy for trying this out. Would you be able to try it with your reverse proxy and script server running on different hosts? That's the only difference I can think of between your setup and mine.

Meanwhile, I will try to move my container to the same host that has my proxy and see if it works there.

Feel free to call out if none of this makes sense. I am guessing it has something to do with $proxy_host and 127.0.0.1 essentially being the same in your case. So maybe the Host and Origin proxy headers have some play here when the proxy_pass is to a non-local location.

Edit : Not a proxy / nginx expert either. Just guessing.

from script-server.

narenarora avatar narenarora commented on June 9, 2024

Incase this is where the issue is, below is my conf.json

{
  "port": 5000,
  "address": "0.0.0.0",
  "title": "My Script Server",
  "auth": {
        "type": "htpasswd",
        "htpasswd_path": "/auth/.htpasswd"
  },
  "access": {
        "admin_users": [ "admin" ]
  },
  "callbacks": {
    "notify_on_start": false,
    "notify_on_finish": true,
    "notification_fields": [ "execution_id", "script_name", "user", "audit_command", "exit_code" ],
    "destinations": [
        {
            "type": "http",
            "url": "http://ntfy/topic"
        }
    ]
  },
  "logging": {
    "execution_file": "$DATE-$ID.log",
    "execution_date_format": "%y-%m-%d_%H-%M"
  },
  "security": {
    "xsrf_protection": "token"
  }
}

from script-server.

narenarora avatar narenarora commented on June 9, 2024

If this helps .. this is my redirection log. Looks like once it hits index.html , it is internally redirected to /login.html without the subpath

$ curl -vL https://mydomain.com/myscripts 2>&1 | grep -i location
< location: https://mydomain.com/myscripts/
< location: http://mydomain.com/login.html?next=%2Fmyscripts%2F
< Location: https://mydomain.com/login.html?next=%2Fmyscripts%2F

I did try to run the script-server container on the same host as the proxy, but same issue. All the proxy configs I have seen in the issues seem to be proxy running on the host directly, so http://127.0.0.1:5000 is a valid location. Since I have my proxy running as a container, 127.0.0.1 doesn't apply.

Using a subdomain works, as expected. But I'd really like to find a solution for this using a subpath.

from script-server.

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.