Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


NginX Proxy to Provider's Solus
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

NginX Proxy to Provider's Solus

clarity_64clarity_64 Member
edited December 2011 in General

As we all know, some providers have their solus on non-standard ports, and this creates issues when you are behind a firewall at work. I know there are several ways around this, but I would like to setup a reverse proxy to the provider's site. Is this possible?

Here is the current setup I am using that is not working, and I am not that great with the harder configs of NginX.

location /provider/ {

access_log off;
proxy_pass https://solus.provider.com:5656;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Comments

  • Any ideas guys?

  • I just use Squid and Dante myself; don't really have any experience with NginX, sorry =\

  • Well, I have a PPTP VPN setup and stuff, but I want to try it this way.

    From everything I am seeing, it is setup right, but I am getting an error message from the provider's apache. I can only guess it has something to do with the headers.

  • If I add login.php/ to the end of the proxy_pass the site loads, but it doesn't follow the new pages.

    location /provider/ {
    access_log off;
    proxy_pass https://solus.provider.com:5656/login.php/;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    You can see what I mean at status.clardyhost.com/hostigation

  • I'm not really an expert on this, but my guess would be that you open your nginx's website with smth like http://dclardy.net/provider/ but there are always issues whent he path in your browser isn't the path configured in Solus or whatever.
    From what i see theres no way to fix this by changing your nginx's configuration file.

  • clarity_64clarity_64 Member
    edited December 2011

    proxy_pass https://solus.provider.com:5656$request_uri;

    This gives a 502 bad gateway error.

    2011/12/13 20:54:26 [error] 27951#0: *5794 no resolver defined to resolve solus.hostigation.com, client: 12.6.128.8, server: status.clardyhost.com, request: "GET /hostigation/ HTTP/1.1", host: "status.clardyhost.com"

  • @dmmcintyre3 said: how about:

    proxy_pass https://solus.provider.com:5656$uri;

    Bad gateway on that as well.

  • clarity_64clarity_64 Member
    edited December 2011

    I think that I have gotten it. I can't look at the pretty images though. I will look into why that is.

    Edit:

    I got it to work. If you would like to login to hostigation from behind a firewall, you can use hostigation.clardyhost.com!

  • So post the solution please

  • clarity_64clarity_64 Member
    edited December 2011

    Here is the config that finally got it working for me.

     server {
            listen 80;
            server_name hostigation.clardyhost.com;
            access_log /var/log/nginx/hostigation.access.log;
            error_log /var/log/nginx/hostigation.error.log;
            location / {
                    proxy_pass https://solus.hostigation.com:5656/;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_redirect default;
            }
    }
    
  • God the code highlighting looks horrible. Can we get something better?

  • japonjapon Member
    edited December 2011

    code with '

    code width pre-tags
  • @dclardy said: God the code highlighting looks horrible. Can we get something better?

    Use < pre>< code> </ code></ pre> (Remove space) instead ``

  • clarity_64clarity_64 Member
    edited December 2011

    Updated. Thanks for the help! Can we not edit the the code button to place those instead of the ``

  • Sorry to bump this topic up :D

    My ISP blocked access to facebook, I'm trying to create a proxy, like you did. I replaced:

    proxy_pass https://solus.hostigation.com:5656/;

    with:

    proxy_pass https://www.facebook.com/;

    but it didn't work. It redirects to facebook.com instead serve the facebook page on my domain. Any solution? :-s

  • @giang: Maybe try the mobile FB site (the mobile site doesn't depend heavily on JS).

  • @Adam said: Maybe try the mobile FB site (the mobile site doesn't depend heavily on JS).

    My ISP blocked all access to facebook :( Even mobile page/mobile apps :|

  • @giang said: My ISP blocked all access to facebook :( Even mobile page/mobile apps :|

    Was meaning put the mobile site into nginx instead of the main site: http://m.facebook.com/

  • I could make it work by remove:

    proxy_set_header Host $host;

    But it still need to connect to www.facebook.com when login, register... :(

  • This will get you to the facebook site. The only issue is when you try to login, you are redirected. I will look into that more.

    server {
            listen 80;
            server_name facebook.clardyhost.com;
    
            access_log /var/log/nginx/faceboook.access.log;
            error_log /var/log/nginx/facebook.error.log;
    
            location / {
                    proxy_pass https://www.facebook.com/;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host www.facebook.com;
                    proxy_redirect default;
            }
    
    }
    
    
  • netomxnetomx Moderator, Veteran

    Your ISP block Facebook? Wow, never seen that (except China) ... are you in China? You can try VPN.

  • @netomx said: Your ISP block Facebook? Wow, never seen that (except China) ... are you in China? You can try VPN.

    No, I'm Vietnamese. A lot of coutries blocked facebook, not only china :(
    My ISP seems got problem with AAG (Asia American Gateway) cable, broken (again @_@) or something so they temporary use china gateway :|

  • @giang said: My ISP blocked all access to facebook :( Even mobile page/mobile apps :|

    Facebook uses a ton of javascript, almost NOTHING is loaded off www.facebook.com

  • @giang: Why don't you simply setup SSH tunnel?

Sign In or Register to comment.