4

I trying to use all features of api-platform to test this solution. I don't want use the docker stack to understand the construction.

My test API is now created and useable.

api https://ibb.co/hcjyrJ

Entrypoint: http://api.localhost

My problem is when i will install admin with the official tutorial.

  • I don't have any error or warning during installation with yarn

api install https://ibb.co/gmK1dy

  • I have modified the src/App.js file with my entrypoint

api js https://ibb.co/nQKHJy

  • I have modify API CORS HTTP Headers to allow the admin's domain to access it. The admin's domain is http://localhost:3000

api cors https://ibb.co/niH7kd

When I try to access to admin : http://localhost:3000, I have the message Unable to retrieve API documentation.

I don't have any message in console. If I check my network tab, I can view the call to the API with the correct response.

api admin https://ibb.co/injbdy

If you have any ideas.. I get them all !

Vincent Faliès
  • 298
  • 3
  • 10
  • Is this Admin-On-Rest?? I cannot recognize it. Are you sure you tagged correctly???? – kunal pareek May 18 '18 at 10:20
  • As precised, I use [api-platform solution](https://api-platform.com/). The admin is a part of this solution and using admin-on-rest. This is decribe on [official tutorial](https://api-platform.com/docs/admin/getting-started) – Vincent Faliès May 18 '18 at 10:38
  • Please put code into your question instead of using screenshots. – A.L May 22 '18 at 15:38

1 Answers1

7

I've found the solution at this problem.

In nelmio_cors.yaml, you must add Link in expose_headers.

The file must look like as:

nelmio_cors:
defaults:
    origin_regex: true
    allow_origin: ['*']
    allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
    allow_headers: ['Content-Type', 'Authorization']
    expose_headers: ['Content-Disposition', 'Content-Length', 'Link']
    max_age: 3600
paths:
    '^/': ~
Vincent Faliès
  • 298
  • 3
  • 10