× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thank you.  In 4th grade I had to take a note to the teacher in 8th grade.  They were doing math.  I just read your response and I have the same feeling I had then...

You realize it'll take me at least a week to figure this out. *grin*  It'll keep me busy and out of the beer halls and brothels, right?  That's a good thing.  Thank you.

On 4/6/2019 4:30 AM, Tim Fathers wrote:
Hmm, haven't you gone round in a circle here? Isn't this what introducing the reverse proxy should have solved? You should not have to mess around with CORS to get this to work. If the index.html is being served from the same host as the API (or apparently the same host because of the reverse proxy) then it should just work. If you are serving the index.html from a local web server on your PC then you must configure this as a reverse proxy as well so that it redirects API calls to the real host. If you are just opening the HTML file directly in the browser then it will not work, it needs to be served from a local web server like this, for example, https://www.npmjs.com/package/http-server However, in both the latter cases it wouldn't work at all unless you are using absolute URLs for your AJAX API calls, which you shouldn't be, so all AJAX calls should be to '/api/someendpoint...' not 'http://an.ip/api/someendpoint'.

It sounds to me like you're just opening the index.html locally and in it you have used absolute URLs to the API, which won't work, if so, try this.

1) change any absolute URLs in your index.html to relative ones
2) install http-server
> npm install http-server -g
3) cd <to_where_your_index.html_is>
4) run the server, proxying unknown URLs to your API...
> http-server --proxy http://youribmi/api
5) point your browser at localhost:8080 and your page should work as expected

Tim.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.