Jump to content

NGINX / uWSGI: masking URL path with base


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...