Jump to content

NGINX / uWSGI: masking URL path with base


Mad_Griffith
 Share

Recommended Posts

Hi I would like to mask `domain2.com/my-path/` with `domain2.com` (base URL).

I have done the following and it works:

    location = / {
        proxy_pass http://domain2.com/my-path/;
    }

But now I don't know how to bar the user from accessing `domain2.com/my-path/` directly or, from that address, redirect him to `domain2.com`, without influencing the solution above.

Also, I am not fully convinced of using the `proxy_pass` directive, as I am using uWSGI and could maybe use `uwsgi_pass`, but something like the following throws an `invalid host in upstream` error:

    location = / {
        uwsgi_param QUERY_STRING $query_string;
        uwsgi_param REQUEST_METHOD $request_method;
        uwsgi_param CONTENT_TYPE $content_type;
        uwsgi_param CONTENT_LENGTH $content_length;
        uwsgi_param REQUEST_URI $request_uri;
        uwsgi_param PATH_INFO $document_uri;
        uwsgi_param DOCUMENT_ROOT $document_root;
        uwsgi_param SERVER_PROTOCOL $server_protocol;
        uwsgi_param REMOTE_ADDR $remote_addr;
        uwsgi_param REMOTE_PORT $remote_port;
        uwsgi_param SERVER_ADDR $server_addr;
        uwsgi_param SERVER_PORT $server_port;
        uwsgi_param SERVER_NAME $server_name;
        uwsgi_pass http://domain2.com/my-path/;
    }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...