ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By ArchimedesPi
#5995 @l3xluthor:
Your problem is, as Sprite_tm says, probably the Same-Origin policy.
There are two ways to get around this.
The first one, Cross-Origin Resource Sharing, requires modification to the esp-httpd code so that it returns a Access-Control-Allow-Origin HTTP header.
The much simpler (in some respects) way to get around the SO policy is to use JSONP, which jQuery supports.
Either way, you'll have to change some code on the ESP8266.
User avatar
By FeK9
#6003
folny82 wrote:Hello

I want to ask aka, the maximum file size webpages.espfs ? because if my files larger than 140kB so esphttpd does not work.


GDay folny

I've asked the same question/researched on these forums and +-180kB size is the max suggested.

0x40000 minus 0x12000 = 0x2E000... or 188416 bytes in decimal.

And the problem for me is that I can not take the size of the webpages.espfs 'one byte or more' than 128kB (131 072 bytes),
after that the serial puts out junk and every thing needs to be reflashed.

Regards - FeK9

Ps I've seen the post/response by Sprite_tm to your question, I be-leave he's referring to line 157 of the makefile.
if [ $$(stat -c '%s' webpages.espfs) -gt $$(( 0x2E000 )) ]; then echo "webpages.espfs too big!";
User avatar
By l3xluthor
#6007
Sprite_tm wrote:Depends, what are you trying to do? If both ESPs are on the same network, they should be able to connect just fine; all you'd need is a protocol inbetween the two; I'll leave creating one or making a HTTP client to you. If not, you'd have to fiddle around with AP+STA mode and make connections on the fly; I'm not sure how good an idea that would be.


Thanks for your reply Sprite_tm, as starting point I just want to set GPIO2 high and low, so, as you said maybe get connected and disconnected to each ESP that I want to talk to could be a possible solution also trying to avoid the same-origin policy in the browser could be another option, Im going to explore both and I'll share here what happened, at the end I wanted to hear other points of view of people involved on this. Thanks again!!
User avatar
By l3xluthor
#6008
ArchimedesPi wrote:There are two ways to get around this.
The first one, Cross-Origin Resource Sharing, requires modification to the esp-httpd code so that it returns a Access-Control-Allow-Origin HTTP header.
The much simpler (in some respects) way to get around the SO policy is to use JSONP, which jQuery supports.
Either way, you'll have to change some code on the ESP8266.


Thanks for your reply, I think both of them could work, but I have to do some research on them and also Im going to follow your suggestion about the easiest one "JSONP", I'll let you know if I get lucky.