getmaxun / maxun

Free, open-source no-code web data extraction platform. Build custom robots to automate data scraping [In Beta]
GNU Affero General Public License v3.0
2.93k stars 188 forks source link

strict-origin-when-cross-origin #127

Closed npo5tech closed 1 hour ago

npo5tech commented 3 hours ago

I ran it on a remote server and set up a reverse proxy with different ports and bound the domain name, but it didn't work.

When I tried to register, it gave a cross-domain error

Access to XMLHttpRequest at 'https://xxxx:8007/auth/register' from origin 'https://xxxx:8009' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://localhost:5173' that is not equal to the supplied origin.

npo5tech commented 3 hours ago

nginx config

add_header Access-Control-Allow-Origin 'https://xxxx:8009';
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Credentials "true";
amhsirak commented 1 hour ago

@npo5tech why are you running on a remote server and setup a reverse proxy? We've only set the infrastructure for local development now, and are working to setup it up for production.

Is setting up with a reverse proxy important for you now?

npo5tech commented 1 hour ago

@npo5tech why are you running on a remote server and setup a reverse proxy? We've only set the infrastructure for local development now, and are working to setup it up for production.

Is setting up with a reverse proxy important for you now?

Thanks for the reply I am trying to use it now and want it to work while I sleep, so I need to run it on a vps

I have made it work by modifying the nginx configuration

    proxy_hide_header Access-Control-Allow-Origin;
    proxy_hide_header Access-Control-Allow-Credentials;
    add_header Access-Control-Allow-Origin https://xxxx:8009 always;
    add_header Access-Control-Allow-Headers "Accept,Accept-Encoding,Accept-Language,Connection,Content-Length,Content-Type,Host,Origin,Referer,User-Agent";
    add_header Access-Control-Allow-Methods "GET, POST, PUT, OPTIONS";
    add_header Access-Control-Allow-Credentials 'true';
    if ($request_method = 'OPTIONS') {
        return 200;
    }
    proxy_cookie_domain ~\.?127.0.0.1:8080 $host;
amhsirak commented 1 hour ago

@npo5tech thank you! Would you mind opening a PR and setting this up so that others could benefit from it too?