Topic on Talk:RESTBase

VisualEditor together with RESTBase give HTTP 404 apierror-visualeditor-docserver-http

1
Magol (talkcontribs)

I try to setup a Mediawiki with Visual Editor, Parsoid and RESTBase.

I have been able to setup the wiki with only Visual Editor and Parsoid, but when I try to get RESTBase to work I get problems.

When I try to edit a page with Visual Editor and try to save, I get a HTTP 404 apierror-visualeditor-docserver-http

See my code at https://github.com/magol/sag-wiki/tree/master/sag-wiki

Settings for Virtual Editor

    $wgVirtualRestConfig['modules']['parsoid'] = array(
        'url'                   => getenv( 'MEDIAWIKI_PARSOID_URL' ),
        'domain'                => 'localhost',
        'prefix'                => 'localhost'
    );
    
    $wgVirtualRestConfig['modules']['restbase'] = array(
    	'url' => getenv( 'MEDIAWIKI_SERVER' ).'/api/rest_v1',
    	'domain' => 'localhost', # matches the "domain" used above
    	'forwardCookies' => true,
    	'parsoidCompat' => false
    );
    $wgVisualEditorRestbaseURL     = getenv( 'MEDIAWIKI_SERVER' ).'/api/rest_v1/page/html/';
    $wgVisualEditorFullRestbaseURL = getenv( 'MEDIAWIKI_SERVER' ).'/api/rest_';

Settings for RESTBase

services:
  - name: restbase
    module: hyperswitch
    conf:
      port: {env(RESTBASE_PORT,7231)}
      salt: secret
      default_page_size: 125
      user_agent: RESTBase
      ui_name: RESTBase
      ui_url: https://www.mediawiki.org/wiki/RESTBase
      ui_title: RESTBase docs
      spec:
        x-request-filters:
          - path: lib/security_response_header_filter.js
          - path: lib/normalize_headers_filter.js
        x-sub-request-filters:
          - type: default
            name: http
            options:
              allow:
                - pattern: '{env(MEDIAWIKI_API_URL,http://localhost/w/api.php)}'
                  forward_headers: true
                - pattern: http://localhost:8142
                  forward_headers: true
                - pattern: /^https?:\/\//
        paths:
          /{domain:localhost}:
            x-modules:
              - path: projects/example.yaml
                options:
                  action:
                    # XXX Check API URL!
                    apiUriTemplate: '{env(MEDIAWIKI_API_URL,http://localhost/w/api.php)}'
                    # XXX Check the base RESTBase URI
                    baseUriTemplate: "{{'http://{domain}:7231/{domain}/v1'}}"
                  parsoid:
                    # XXX Check Parsoid URL!
                    host: '{env(PARSOID_HOST_PORT,http://localhost:8142)}'
                  table:
                    backend: sqlite
                    dbname: /data/restbase_tables.sqlite3
                    pool_idle_timeout: 20000
                    retry_delay: 250
                    retry_limit: 10
                    show_sql: false
                  mathoid:
                    host: '{env(MATHOID_HOST_PORT,http://localhost:10044)}'
                  mobileapps:
                    host: '{env(MOBILEAPPS_URI,https://appservice.wmflabs.org)}'
                  citoid:
                    host: '{env(CITOID_URI,http://localhost:1970)}'
                  purged_cache_control: s-maxage=0, max-age=86400
                  purged_cache_control_client_cache: s-maxage=0, max-age=300

# Finally, a standard service-runner config.
info:
  name: restbase

logging:
  name: restbase
  level: '{env(RESTBASE_LOGGING_LEVEL,info)}'

num_workers: 1

Settings for Parsoid

    num_workers: '0'
    worker_heartbeat_timeout: 300000
    logging:
        level: info
    services:
      - module: lib/index.js
        entrypoint: apiServiceWorker
        conf:
            serverPort: 8142
            mwApis:
              -
                uri: 'http://web/w/api.php'
                domain: 'localhost'
Reply to "VisualEditor together with RESTBase give HTTP 404 apierror-visualeditor-docserver-http"