New Mars Forums

Official discussion forum of The Mars Society and MarsNews.com

You are not logged in.

Announcement

Announcement: This forum is accepting new registrations by emailing newmarsmember * gmail.com become a registered member. Read the Recruiting expertise for NewMars Forum topic in Meta New Mars for other information for this process.

#226 2022-12-24 22:01:49

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For SpaceNut re Proxy study....

Privoxy has the capability of reporting activity in a number of levels, indicated by setting bits such as 1,2,4 etc.

Setting all the bits on with 65535 yields a flood of data.  Selecting a smaller set of debug information showed that the proxy is working for browser traffic, but failing for the JavaScript fetch.  This evening I set the debug request back to all-options-on, and ran a short set of tests, and got 50 megabytes of data.  The tests I ran were:
1) JavaScript Setup/Worker which timed out as usual
2) NewMars Active command

The background activity that goes on when Edge starts created the vast majority of those 50 megabytes.

After pondering all that data for a while, it crossed my mind that it ** might ** be possible to let the browser handle the connection to the proxy, and just remove the section of uRL that is needed to use the Heroku demo site.

I'll try that tomorrow.

(th)

Offline

#227 2022-12-25 08:53:41

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For SpaceNut re Proxy study ....

Post #226 reports on a possible insight that arose from study of a voluminous dump of data from a brief test last night.

Privoxy recorded 50 megabytes of data from a very short browser session.  The debug options had all been turned on, so it was necessary to wade through literally megabytes of normal activity to find a tiny trace of a failed transmission from JavaScript, and a successful connection to NewMars by the browser.

The insight that arose was that (perhaps?possibly?) the browser proxy configuration will handle delivery of the JavaScript request to the proxy?

I'll try that later today.  The theory (if that's the right word for a wild guess) is that JavaScript traffic is handled by the same outbound code as the screen initiated requests.

I came to this realization way too slowly, but here it is ...

The existing pattern is based upon the model provided by Heroku, who kindly provide a proxy for their students to use JavaScript to bypass the CORS restrictions, that exist to try to hinder hackers.

The Heroku model looks like this:  [path to demo proxy] [slash] [path to NewMars]

What I am seeing in the Provoxy log is:

Normal lookup: [NewMars URL]
JavaScript request:[path to privoxy proxy]

So! what this tells me is that the browser configuration, to use the privoxy proxy, is working as intended.

In other words, conceptually, we have: [path to privoxy proxy] [path to privoxy proxy] [path to NewMars]

In the experiment I am planning for later today, I'll remove the proxy segment from the JavaScript request.

If this ** works ** it means the browser can be enlisted to solve the proxy problem.

it ** also ** means that any of the many proxies available to you might work.

Privoxy ** is ** available for Windows, and while I ran into a permissions issue, the Linux SIG ran it just fine in a Windows 11 instance inside a Virtual Machine running on a Mac.  I have deleted the Privoxy service from the Windows machine, because Provoxy is running fine on Ubuntu 22.04.  From my perspective, the Linux instance is ** much ** easier to work with than the Windows version, because of the developer friendly environment.

(th)

Offline

#228 2022-12-25 14:08:24

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For SpaceNut re Proxy Saga ...

I ** think ** I finally got the browser to send JavaScript traffic through the proxy, but I'm not sure, because the error message that showed up was the familiar CORS messages from the first attempts to use Fetch.

In what amounts to a Hail Mary effort, I asked Google (or Bing) if there is a way to configure privoxy to satisfy CORS.

The search engine came back with quite a list of snippets:

stackoverflow.com › questions › 37966457How to use CORS in Javascript? - Stack Overflow
Jun 22, 2016 · CORS is a server side feature that the new browsers support. When you request a resource from a cross domain service, the browser performs a preflight request to the server and asks him for access information. If the server allows you to access it's resource from a different domain, it will send back some HTTP headers and the browser will decide upon those headers about your actions.

medium.com › nodejsmadeeasy › a-simple-cors-proxyA Simple Cors Proxy for Javascript Browser applications
Mar 17, 2020 · A Simple Cors Proxy for Javascript Browser applications | by Sandeep | NodejsMadeEasy | Medium 500 Apologies, but something went wrong on our end. Refresh the page, check Medium ’s site...

People also ask
How do I set up a CORS policy for Ajax?

How do I enable cross-origin requests on a CORS server?

What is Cors proxy?

Should I set CORS to be as restrictive as possible?

www.moxio.com › blog › 12How to make a cross domain request in JavaScript using CORS
We'll look at how to set up CORS on the server in PHP, how to make the request in JavaScript and some considerations. CORS as a concept is broader than just AJAX requests but this is it's main use. Here at Moxio we use cross domain requests for our single sign-on service. We will explain how to implement CORS using a single sign-on service as an example. Single Sign-on overview. Here you can see a flow chart describing our sign-on process.

stackoverflow.com › questions › 60270574javascript - How to set CORS headers to a client - Stack Overflow
Setting the Access-Control-Allow-Origin to a specific domain and disabling CORS makes it so no one could invoke your API outside of your domain, therefore giving you the error you are getting currently. Here is an example response from the server in JavaScript. var response = { "isBase64Encoded": false, "headers": { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'}, "statusCode": 200, "body": " {\"result\": \"Success.\"}"

Searches related to how to set privoxy options to satisfy cors in javascript
how to set privoxy options to satisfy cors in javascript w3schools
how to set privoxy options to satisfy cors in javascript and html
how to set privoxy options to satisfy cors in javascript example
how to set privoxy options to satisfy cors in javascript 5
how to set privoxy options to satisfy cors in javascript code
how to set privoxy options to satisfy cors in javascript tutorial
how to set privoxy options to satisfy cors in javascript and php
how to set privoxy options to satisfy cors in javascript and css

I'm taking a break to do some chores so will return to this later.

(th)

Offline

#229 2022-12-25 20:18:07

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For SpaceNut re CORS investigation continuing ....

I've been wondering what the Heroku site is doing that works so well ...

About
CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.

Resources
Readme

The application is available on Github  .... there is a hint that a copy of the application can be installed by anyone.

What throws me for a loop here is the statement that the application is a ** reverse ** proxy.

Privoxy is a forward proxy .... I'm not sure what a reverse proxy is.

This situation is bordering on ridiculous.

(th)

Offline

#230 2022-12-26 09:45:20

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

SearchTerm:nocors
SearchTerm:no-cors

Per Google ...

Trying to use fetch and pass in mode: no-cors - Stack Overflowhttps://stackoverflow.com › questions › trying-to-use-fe...
Apr 6, 2017 — I needed to configure my Express server with the CORS.js package - github.com/expressjs/cors - and then I needed to remove mode: 'no-cors' from ...
11 answers

·

Top answer:
mode: 'no-cors' won’t magically make things work. In fact it makes things worse, because ...
How to fix the "set the request's mode to 'no-cors'" error?
Jan 22, 2019
How use no-cors with fetch() - javascript - Stack Overflow
Dec 8, 2020
Unable to fetch POST without no-cors in header - Stack Overflow
Jun 6, 2016
Using fetch API with mode: 'no-cors', can't set request headers
Jun 17, 2017
More results from stackoverflow.com
People also ask
How do you set the request's mode to no CORS in Fetch?
You can set the request mode to 'no-cors' like so: fetch(url, { mode: "no-cors", ... })

set the request's mode to 'no-cors' to fetch the ... - You.comhttps://you.com › search › set the request's mode to 'no-...
Search for: How do you set the request's mode to no CORS in Fetch?
How do you set the request's mode to no CORS to fetch the resource with CORS disabled?
What does no CORS mean in Fetch?
Does fetch allow CORS?
How do I disable CORS in API?
How do you avoid CORS policy?
Feedback

Request.mode - Web APIs - MDN Web Docshttps://developer.mozilla.org › ... › Web APIs › Request
Sep 8, 2022 — Value · same-origin. If a request is made to another origin with this mode set, the result is an error. · no-cors. Prevents the method from being ...
Value · Examples · Browser compatibility

Using the Fetch API - MDN Web Docshttps://developer.mozilla.org › ... › Fetch API
Sep 8, 2022 — A basic fetch request is really simple to set up. ... Note that mode: "no-cors" only allows a limited set of headers in the request:.

Access to fetch been blocked by CORS policy - React Native + ...https://learn.microsoft.com › answers › questions › bloc...
Oct 2, 2022 — If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

set the request's mode to 'no-cors' to fetch the ... - You.comhttps://you.com › search › set the request's mode to 'no-...
bash No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' ...

set the request's mode to 'no-cors' to fetch the resource with ...https://www.codeproject.com › Questions › CORS-error...
Nov 23, 2020 — If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. What I have tried: 1) ...
1 answer

·

0 votes:
Your API is not returning a CORS header. Since we can't see your code, we can't tell you why. All we can tell you is what the error message is already ...

Common no-cors misconceptions - Evert Pothttps://evertpot.com › no-cors
Mar 19, 2020 — If you're trying to fetch() to another origin, and this origin does not opt into CORS, your request will return a network error and some ...

Fixing Common Problems with CORS and JavaScripthttps://developer.okta.com › blog › 2021/08/02 › fix-c...
Aug 2, 2021 — It suggests two solutions. The second suggestion is to change the mode from cors to no-cors in the JavaScript fetch request. This is not an ...
How To Solve A Simple Cors... · Cors In Flight · What Else Does Cors Block?
You visited this page on 10/18/22.

Serving - web.devhttps://web.dev › learn › pwa › serving
In addition to navigation and asset requests, fetching from an installed service worker allows page visits after a site's first load to be rendered without ...
The Fetch Event # · Service Worker · Responding From The Cache #

Fetch API - The Modern JavaScript Tutorialhttps://javascript.info › Network requests
Oct 12, 2022 — These options govern how fetch sets the HTTP Referer header. ... "no-cors" – only safe cross-origin requests are allowed.
People also ask

(th)

Offline

#231 2022-12-27 09:24:23

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For SpaceNut re JavaScript initiative, and specifically the CORS hurdle ....

Per advice given at one of the sites listed in the post ahead of this one, I modified Setup and Worker in hopes of preventing the CORS blockage.

My hope had been that a forward proxy would solve the problem, but it turns out that privoxy out of the box does NOT provide a solution.

There may be adjustments of the privoxy configuration that ** would ** solve the problem, but so far I've not found them, or if I found them, I did not understand what I was reading, so the effect was null.

Today's attempt will use a parameter offered by one of the Internet contributors... I don't expect success, but will make the attempt later today.

(th)

Offline

#232 2023-01-17 19:38:22

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For SpaceNut re JavaScript initiative

Things have been quiet in this topic since the CORS problem became the last man standing.

From Ty to Everyone 08:31 PM
https://www.cloudflare.com/learning/cdn … rse-proxy/


The Linux SIG meeting took another dive in to Linux (as usual) but they gave me a bit of time to report on the proxy assignment I got last month.  The result is that Privoxy (or any other Forward proxy) cannot solve the CORS problem.

I learned how to set up and to run (and to debug) Privoxy, but none of that made a difference.

It turns out that what is needed is a "Reverse" proxy, so that's the next hurdle.

The link above is where I'll start tomorrow, in hopes of learning how to set up a Reverse Proxy.

The demo CORS site we've been using (it turns out) ** is ** a reverse proxy.

(th)

Offline

#233 2023-01-19 11:22:09

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

Here is another suggestion from the local Linux SIG regarding Reverse Proxy, as needed to solve the CORS problem reported in this topic.

There are several options for the reverse proxy role, one of them being Apache, which is available on practically all Windows, Mac, and Linux platforms.  It's very widely used and well supported.

Normally it's a web server, but it can also be configured to be a reverse proxy.

I'd propose giving that a try.

Some of the other reverse proxy candidates can handle hundreds of thousands of connections.

That level of performance seems to be overkill.  Apache should be very adequate for our purposes.  I've used it in some Linux VMs and I have an Apache server running on my Mac.

I know you love adventure, so here are a couple of links to get you started on Apache:

    The main Apache project web page: https://httpd.apache.org
    The download page: https://httpd.apache.org/download.cgi
    The root page for docs.  I'd suggest staring with the "Getting Started" entry in the Users' Guide section.
    The root web page for configuring Apache to be a reverse proxy: https://httpd.apache.org/docs/2.4/howto … proxy.html

As always, please send an SOS if you need assistance!

I am familiar with Apache server software, and ran a site years ago, so expect/hope to be able to construct a new one without too much difficulty.

It sure is reassuring to see the solution may lie in this direction.

(th)

Offline

#234 2023-02-06 14:25:13

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

This is a follow up to #233

https://stackoverflow.com/questions/603 … untu-18-04

Above is a link to a set of questions and answers regarding the problem of Apache failing to start.

The most likely cause of the failure I am seeing is that I am already using Port 80, because I installed Squid in an unsuccessful attempt to create a Reverse Proxy.  It turns out that Squid is not the right tool, nor is Privoxy.

Because the next meeting of the local Linux group is coming up in a couple of weeks, and I am expected to have installed Apache by then, I've started the process of attempting to find the cause of the startup failure.

As a reminder, the purpose of the current investigation is to find a replacement for the temporary/learning Reverse Proxy that has been used throughout this topic, to complete the steps needed to make a working JavaScript application to look at TestID's.

That application is running correctly, so now the Reverse Proxy hurdle is directly ahead.

Update a bit later ...

Stack Overflow had suggestions for how to get Apache running.

I tried several suggestions before discovering a log file entry that reported Apache could not find php.

Stack Overflow had suggestions for ** that ** problem...

You are missing part of your PHP/Apache installation. You might have a PHP module installation conflict 1) apt update && apt upgrade 2) Reboot the server. 3) apt install libapache2-mod-php7.4 4) Run those commands with sudo. 5) My guess is that you have partially installed both PHP 7.x and 8.x . –
John Hanley
Apr 22, 2022 at 21:05

I'll restart Ubuntu after php was installed, to see if Apache comes up this time.

Update a bit later yet .... php has upgraded from 7 to 8 recently, and the Apache installation was not updated to match.

I am attempting to update the command file fpr php:

# Conflicts: php5
# Depends: mpm_prefork
LoadModule php8_module /usr/lib/apache2/modules/libphp8.1.so

Update later ... Apache is finally running ... it turned out that the module name "php8_module" is now "php_module"

(th)

Offline

#235 2023-02-06 21:09:18

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

Apache looks like this in default mode;

Apache2 Default Page
It works!
This is the default welcome page used to test the correct operation of the Apache2 server after installation on Ubuntu systems. It is based on the equivalent page on Debian, from which the Ubuntu Apache packaging is derived. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server.

If you are a normal user of this web site and don't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site's administrator.

Configuration Overview
Ubuntu's Apache2 default configuration is different from the upstream default configuration, and split into several files optimized for interaction with Ubuntu tools. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz. Refer to this for the full documentation. Documentation for the web server itself can be found by accessing the manual if the apache2-doc package was installed on this server.

The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:

/etc/apache2/
|-- apache2.conf
|       `--  ports.conf
|-- mods-enabled
|       |-- *.load
|       `-- *.conf
|-- conf-enabled
|       `-- *.conf
|-- sites-enabled
|       `-- *.conf
         
apache2.conf is the main configuration file. It puts the pieces together by including all remaining configuration files when starting up the web server.
ports.conf is always included from the main configuration file. It is used to determine the listening ports for incoming connections, and this file can be customized anytime.
Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ directories contain particular configuration snippets which manage modules, global configuration fragments, or virtual host configurations, respectively.
They are activated by symlinking available configuration files from their respective *-available/ counterparts. These should be managed by using our helpers a2enmod, a2dismod, a2ensite, a2dissite, and a2enconf, a2disconf . See their respective man pages for detailed information.
The binary is called apache2 and is managed using systemd, so to start/stop the service use systemctl start apache2 and systemctl stop apache2, and use systemctl status apache2 and journalctl -u apache2 to check status. system and apache2ctl can also be used for service management if desired. Calling /usr/bin/apache2 directly will not work with the default configuration.
Document Roots
By default, Ubuntu does not allow access through the web browser to any file outside of those located in /var/www, public_html directories (when enabled) and /usr/share (for web applications). If your site is using a web document root located elsewhere (such as in /srv) you may need to whitelist your document root directory in /etc/apache2/apache2.conf.

The default Ubuntu document root is /var/www/html. You can make your own virtual hosts under /var/www.

Reporting Problems
Please use the ubuntu-bug tool to report bugs in the Apache2 package with Ubuntu. However, check existing bug reports before reporting a new bug.

Please report bugs specific to modules (such as PHP and others) to their respective packages, not to the web server itself.

The ** next ** step is to find out how to configure Apache as a Reverse Proxy server.

(th)

Offline

#236 2023-02-06 21:19:37

kbd512
Administrator
Registered: 2015-01-02
Posts: 7,852

Re: Java (r) or Javascript Computer Language

Offline

#237 2023-02-06 21:25:36

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

For kbd512 re #236

Thanks for the link ... I'll tackle it tomorrow!

I like the word "simple" in that link << !!! >>

Update Wednesday 2023/02/08 ...
https://www.jamescoyle.net/how-to/116-s … xy-example
#more apache2.conf

This appears to be a Debian installation, because httpd.conf does not exist.  The apache2.conf may be the comparable file.

(th)

Offline

#238 2023-02-26 08:25:17

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

This is an update on post #237 by kbd512

Thanks again for the link provided in #237, to assist with configuring an Apache server as a reverse proxy server.

I've been chipping away at the problem, while tossing a number of other balls into the air.  The server is running reliably, and I ** seem ** to have given it a local server name, because the error message that wanted one is gone. However, the specific conf file that needs to be updated is still not clear to me. The installation package created about 30 conf files, and it scattered conf files in multiple directories, so I'm trying to puzzle out which one needs to be updated with the xml to activate reverse proxy.

Meanwhile, thanks again !!!! for your interest in the Ballistic Orbital Launch to GEO problem!  This topic is available for a combination of html and JavaScript that can solve the problem on ** any ** computer with a modern browser.  I am encouraged to think that a JavaScript solution may become available soon.

I'm sure you understand that a successful solution of the BOLGEO problem will lead to massive investment due to the greatly reduced cost of delivery of non-living mass to GEO.  A solution for GEO will (most likely) lead to a similar solution for LEO, so I am calling for the GEO solution first. 

The problem being addressed is NOT the mathematics.  The mathematics was worked out many decades ago.  The problem to be addressed is mental blockage inside human heads!  Your JavaScript solution will help to remove uncertainty from dozens of minds now, and millions of minds later.

(th)

Offline

#239 2024-09-04 07:28:44

tahanson43206
Moderator
Registered: 2018-04-27
Posts: 19,365

Re: Java (r) or Javascript Computer Language

Our previous work with JavaScript ended when the need for a reverse proxy server showed up, and I was unable to implement a solution despite attempts to do so.

javaScript has come into view as a possible solution to the problem of moving animation from the web server to the local machine.

I'm returning this topic to view in anticipation of announcements along these lines.

(th)

Offline

Board footer

Powered by FluxBB