Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGINX not redirecting #6

Open
AliaMYH opened this issue Apr 20, 2019 · 2 comments
Open

NGINX not redirecting #6

AliaMYH opened this issue Apr 20, 2019 · 2 comments

Comments

@AliaMYH
Copy link

AliaMYH commented Apr 20, 2019

Hi I'm trying to do the final step, which is the redirecting.

I've done the NGINX configuration:

server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name localhost;
#charset koi8-r;

    #access_log  logs/host.access.log  main;

   location / {
        root   html;
        index  index.html index.htm;
    }
    location ~* "^/[0-9a-z@]{5,15}$"  {
            rewrite ^/(.*)$ http://localhost:7000/api/item/$1 redirect;
    }

But the error I get in the browser is :
This site can’t be reached localhost refused to connect.

On Postman it's :

Could not get any response
There was an error connecting to http://localhost/kRKAtUi3r.

Any ideas what's wrong?

@quentin-ma
Copy link

Same issue here. It's seems that you need to check before if nginx redirection to the api work fine. After that you have to launch the server with yarn as it is explain, but it does not work for me as well.

@sudnep
Copy link

sudnep commented Jul 1, 2020

I was able to get it to work. Only that that it not working is the caching part. I have yet to figure out that. But one thing to keep in mind is I was using windows. In windows port 80 is default for IIS default site if you have IIS is installed. In that case you need to change the port number on Nginx to something else other than 80, try 8081
I commented
urlData = await cache.getFromCache('originalUrl', originalUrl); part in urlshorten.js file to skip the cache check.
Also, make sure you are using postman or something similar to validate it is working. You can also put breakpoints and find out where it is erroring out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants