How to handle query properly with nginx

Viewed 11

Nginx noob here...

I am using the Discord Oauth2 and when you login, it sends you to a discord link and then returns something like https://website.com/?code=....

On local with React, it returns fine. But nginx is not handling this at all.

It is suppose to grab the query string, and use that for authentication, and then reload the page and it does this on dev.

How do I get this to work properly for production?

config:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/dev.jugg.gg/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name dev.jugg.gg;
    server_tokens off;
    root /home/forge/dev.jugg.gg/frontend/build/;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate
    # ssl_certificate_key

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/dev.jugg.gg/server/*;

    location / {
        try_files $uri /index.html$is_args$args;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/dev.jugg.gg-error.log error;

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/dev.jugg.gg/after/*;
0 Answers
Related