Giter VIP home page Giter VIP logo

Comments (2)

geektortoise avatar geektortoise commented on July 17, 2024

For the records :
Some element have been given here : https://forum.image.sc/t/integration-of-core-and-web-ui/50806/5

In short :
If you have installed Cytomine following this link https://documentation.cytomine.org/ , your localhost:8000 (when you run "npm run serve" ) should only get blocked by CORS.

In your Cytomine-bootstrap/configs/nginx/nginx.conf file, replace the part related to the “core part” (by default localhost-core) by this one :
(Keep a copy of your nginx.conf file somewhere ! )

	server {
		client_max_body_size 0;
		listen       80;
		server_name  localhost-core;

		#charset koi8-r;
		#access_log  logs/host.access.log  main;

		set $cors_origin "";
		set $cors_cred   "";
		set $cors_header "";
		set $cors_method "";

		if ($http_origin ~* "localhost") {
			set $cors_origin $http_origin;
			set $cors_cred   true;
			set $cors_method 'GET, PUT, POST, DELETE, OPTIONS';
			set $cors_header 'Content-Type, Content-Range, Content-Length, Content-Disposition, Content-Description, Cache-Control, Date, dateFull, authorization, content-type-full, X-Requested-With, Pragma';
		}

		location / {
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header Host $host;
			proxy_pass http://core:8080;

			add_header Access-Control-Allow-Origin      $cors_origin always;
			add_header Access-Control-Allow-Credentials $cors_cred always;
			add_header Access-Control-Allow-Headers     $cors_header always;
			add_header Access-Control-Allow-Methods     $cors_method always;
			add_header Cache-Control 'no-cache';

			if ($request_method = 'OPTIONS') {
				add_header Access-Control-Allow-Origin		$cors_origin always;
				add_header Access-Control-Allow-Credentials 	$cors_cred always;
				add_header Access-Control-Allow-Headers		$cors_header always;
				add_header Access-Control-Allow-Methods 	$cors_method always;
				add_header 'Access-Control-Max-Age' 		1728000;
				add_header 'Content-Type' 			'text/plain charset=UTF-8';
				add_header 'Content-Length' 			0;
				return 204;
			}
		}
	}

Then run the restart.sh script and CORS from localhost origin will be allowed and your local Web-UI displayed on localhost:8000 will be able to contact the Cytomine core.

from cytomine-web-ui.

EimanFatima avatar EimanFatima commented on July 17, 2024

Thank you @geektortoise. This is really helpful and it resolved the problem.

from cytomine-web-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.