Change url subdirectory

edited October 2016 in Questions & Answers
I'm using repetier server on my raspberry pi and I'd like to use the url: "http://<some_ip>:3344/repetier/" instead of: "http://<some_ip>:3344/". Where can I configure this? Thank you.

Comments

  • You can't do that, sorry. But all code assumes the position it has. You could add a reverse proxy (like we described for nginx on linux) and map /repetier to / then you can use the url, but redirection to server would still make it /.
  • I'm certainly not saying this is the right way to do this, but I finally got it to work with the following nginx configuration:

    location ^~ /repetier {
        rewrite               ^/repetier/(.*) /$1 break;
        sub_filter_types      text/html application/javascript text/css;
        sub_filter            '<head>' '<head><base href="/repetier/" />';
        sub_filter            'href="/' 'href="/repetier/';
        sub_filter            'href="../css/' 'href="/repetier/css/';
        sub_filter            'src="/js/' 'src="/repetier/js/';
        sub_filter            'src="/img/' 'src="/repetier/img/';
        sub_filter            'window.location.host+"/socket/' 'window.location.host+"/repetier/socket/';
        sub_filter            'url(\'/' 'url(\'/repetier/';
        sub_filter            'url(\'../' 'url(\'/repetier/';
        sub_filter            'url("/' 'url("/repetier/';
        sub_filter            'url("../' 'url("/repetier/';
        sub_filter_once       off;
    
        proxy_pass            http://SERVER_IP_ADDRESS:3344;
        proxy_set_header      Host $host;
        proxy_set_header      Accept-Encoding "";
        proxy_set_header      X-Real-IP $remote_addr;
        proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header      Upgrade $http_upgrade;
        proxy_set_header      Connection "upgrade";
        proxy_http_version    1.1;
    
        proxy_buffering       off;
    }
    
  • azymux said:
    I'm certainly not saying this is the right way to do this, but I finally got it to work with the following nginx configuration:

    location ^~ /repetier {
        rewrite               ^/repetier/(.*) /$1 break;
        sub_filter_types      text/html application/javascript text/css;
        sub_filter            '<head>' '<head><base href="/repetier/" />';
        sub_filter            'href="/' 'href="/repetier/';
        sub_filter            'href="../css/' 'href="/repetier/css/';
        sub_filter            'src="/js/' 'src="/repetier/js/';
        sub_filter            'src="/img/' 'src="/repetier/img/';
        sub_filter            'window.location.host+"/socket/' 'window.location.host+"/repetier/socket/';
        sub_filter            'url(\'/' 'url(\'/repetier/';
        sub_filter            'url(\'../' 'url(\'/repetier/';
        sub_filter            'url("/' 'url("/repetier/';
        sub_filter            'url("../' 'url("/repetier/';
        sub_filter_once       off;
    
        proxy_pass            http://SERVER_IP_ADDRESS:3344;
        proxy_set_header      Host $host;
        proxy_set_header      Accept-Encoding "";
        proxy_set_header      X-Real-IP $remote_addr;
        proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header      Upgrade $http_upgrade;
        proxy_set_header      Connection "upgrade";
        proxy_http_version    1.1;
    
        proxy_buffering       off;
    }
    
    Nice solution!
    javascript obfuscator
Sign In or Register to comment.