View Issue Details

IDProjectCategoryView StatusLast Update
0009539New Feature Requests[All Projects] Generalpublic2017-06-18 20:54
Reporterharon4iggAssigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0009539: [Request]: Add possibility to set response headers for HTTP exported functions
Description

I tried to integrate my server with my website. Server provides different API methods, using HTTP export feature (e.g. <export function='foo' http='true'/>).

In order to call this methods using JavaScript, i need to return 'Access-Control-Allow-Origin' header with response. So i need to setup this headers somehow, during execution of exported method.

Looks like ipoHttpResponse->oResponseHeaders, should be editable from lua side.

https://github.com/multitheftauto/mtasa-blue/blob/69b4e06a772cbcab9d24b671ec07d06af3b63ee6/Server/mods/deathmatch/logic/CResourceHTMLItem.cpp#L92

TagsNo tags attached.

Activities

W

2017-01-28 22:34

viewer   ~~0025650

Have you considered running a HTTP proxy, such as haproxy or varnish in front of MTA server? Both of them allow you to manipulate requests and responses in real time.

haron4igg

2017-01-28 23:14

viewer   ~~0025652

hm, not yet, but will take a look on it! thank you for suggestion.

W

2017-01-29 00:22

viewer   ~~0025653

Here's a varnish 4 config that should get you going: http://pastebin.com/3ikWsaSP

It forwards all requests to 127.0.0.1:22005 and adds Access-Control-Allow-Origin header to every response.

Issue History

Date Modified Username Field Change